# Patent

## Title
Methods and apparatus for building, customizing and using software abstractions of external entities

## Abstract

An entity is abstracted through implementation of a proxy object of the present invention, including functions for a software application to programmatically interact with the entity at runtime, as well as optional compile and design time implementation classes to support the development and customization of declarative proxy object definitions. In one embodiment, builder and resource interfaces are provided to assist in the creation of the implementation classes. In one embodiment, an extension interface is also provided to facilitate extension of an implementation of the proxy object. Software applications including programmatic usage of proxy object functions are compiled into object codes with proxy objects and meta data files. The compiled object codes are executed using a runtime engine, which includes proxy context objects to facilitate interaction on an instance basis, and an asynchronous event router to route asynchronous events for the entity.

## Background
RELATED APPLICATION
The present invention is related to, and claims priority to provisional application No. 60/359,409, entitled A UNIFIED FRAMEWORK FOR INTERACTING WITH EXTERNAL ENTITIES FROM A PROGRAMMING LANGUAGE AND EXAMPLE APPLICATIONS, filed on Feb. 22, 2002, which specification is hereby fully incorporated by reference.


FIELD OF THE INVENTION
The present invention relates to the field of data processing. More specifically, the present invention is related to software interaction methods.
BACKGROUND OF THE INVENTION
In the course of developing modern software applications, developers are often confronted with the problem of interacting with external entities that don't look, feel or behave like familiar internal programming language objects. These external entities include databases, legacy systems, web services, non-native software components, as well as physical objects (e.g. to control their settings).
Generally, the programmer must learn new paradigms, skills and techniques for interacting with each of these entities. In addition, the programmer must develop or acquire a potentially large body of software to deal with the intricacies of each type of external entity. For example, writing software that interacts with an external web service may require the developer to master several new technologies, including the extensible Markup Language (XML), the XML Schema Language, the XML Protocol (XP a.k.a SOAP) and the Web Service Description Language (WSDL).
Each type of external entity with which the application interacts requires a different set of skills, knowledge and software from the developer. E.g., interacting with a database requires a completely difference set of skills, knowledge and software than interacting with an external web services. The additional burden associated with learning and implementing technologies for interacting with a variety of external entities increases the time, knowledge, skills and ultimately money required to develop a software application.
What is needed is a simple software abstraction that provides uniform access to external entities, reuses the developer's existing knowledge of general software concepts, and minimizes the specialized knowledge required for interacting with each type of external entity. Not only should these software abstractions be easy to use, but they should also be easy to customize for a particular purpose, with little or no software development. The software abstraction should make it easy to interact with several instances of an external entity simultaneously (e.g., use several instances of a web service to perform credit checks for several customers simultaneously). It should also simplify the handling of asynchronous events (e.g., a database trigger) generated by one or more instances of an external entity.
Consider for example the computing environment of FIG. 1. Example computing environment 100, as illustrated, includes servers 102, 115, 120 and 125, and client 112 communicatively coupled, through networking fabric 101.
Server 125 offers as an example ecommerce application 130, with which users of various client devices, such as client 112, may shop and purchase various items. Ecommerce application 130 may include a number of web pages 131 having contents, such as merchandise descriptions, reviews and pricing information, and one or more functions 132.
Complementarily, server 102 offers, as an example, shopping cart service 104 used by ecommerce applications, such as ecommerce application 130 (e.g., when users of client devices interact with their web pages/functions 131/132). As a result, developers of ecommerce applications need not develop their own “shopping cart” functions, and may concentrate their effort on the contents of web pages 131 instead.
Shopping cart service 104 may include e.g. an “add an item to cart” function, a “remove an item from cart” function, and a “checkout” function. In response to a user's selection of e.g. a graphical button displayed on a web page 131, one of functions 132 may cause one or more requests for the appropriate shopping cart functions to be generated and sent to shopping cart service 104 for processing on server 102.
Processing of these requests may in turn require the shopping cart functions to interact for example with services 118 and 128 of servers 115 and 120. Examples of services 118 and 128 are credit authorization, inventory or production slots confirmation, shipment/delivery scheduling, and so forth.
Thus, even in this limited example, developers of ecommerce applications 130 have to equip applications 130 to interact with an external “shopping cart” service 104, while developers of “shopping cart” service 104 have to equip service 104 to interact with external entities such as credit authorization, inventory/production slot confirmation, shipment/delivery scheduling, and so forth.
In addition to the general purpose web service software (e.g., XML, SOAP, WSDL) normally required to facilitate these interactions, each type of web service (e.g., shopping card, credit authorization, shipping) requires specialized software be written to interact with its specific features. For example, software must be written to create the “add item to cart” XML message and send it to the URL address associated with the correct shopping basket. In addition, software must be written to map messages returned by the credit check and shipping services into a form that may be presented to the end user.
As those skilled in the art would appreciate, typically, the example would require simultaneous and asynchronous interaction with several instances of each external service. E.g., at any instance in time, an ecommerce application 130 may be hosting many users, each having a separate shopping cart, containing different items. Shopping cart service 104 in turn may be processing shopping cart interactions for a multitude of carts of different users of different ecommerce applications. In like manner, a credit authorization service may be processing authorization requests for a multitude of checkouts occurring for a number of ecommerce applications at the same time. Notification of final credit approval and shipping arrangements for each of these transactions may occur asynchronously (e.g., via e-mail) after the customer has completed their order(s). Clearly, it is critical that the shopping carts, credit authorizations, shipping details and notifications associated with each customer are correlated and kept separate from that of other customers, even when several customer requests are processed simultaneously. The software required to handle the required correlation and asynchronous event handling can become quite complex.
Even in this relatively simple example, it is clear application developers must generally acquire new and specialized skills, knowledge and software to interact with external entities. They must often create specialized software for interacting with specific forms of each external entity. They must also deal with the complexities of interacting simultaneously and asynchronously with several instances of a given type of entity. Accordingly, a simple software abstraction that provides uniform access to external entities, simplifies creating specialized software abstractions for specific types of external entities, and facilitates interacting simultaneously and asynchronously with multiple instances of an external entity is desired.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention will be described by way of exemplary embodiments, but not limitations, illustrated in the accompanying drawings in which like references denote similar elements, and in which:
FIG. 1 illustrates an example computing environment of the prior art;
FIG. 2 illustrates an overview of the present invention, in accordance with one embodiment;
FIG. 3 illustrates the method of specifying a proxy object for an external entity, in accordance with one embodiment;
FIG. 4 illustrates the method of specifying that a software object is a proxy object for an external entity by direct or indirect association with a marker proxy-object interface, in accordance with one embodiment;
FIG. 5 illustrates an example specification of a proxy object definition for an example external timer;
FIG. 6 illustrates the proxy object implementation of FIG. 2 in further detail, in accordance with one embodiment;
FIG. 7 illustrates an example XML document specifying the syntax of meta-data properties available for customizing the behavior of a proxy object, in accordance with one embodiment;
FIG. 8 illustrates the application development method of the present invention, including usage of software abstractions for external entities, in accordance with one embodiment;
FIGS. 9a-9c illustrate example specifications for declaring a proxy object, setting its properties and handling its asynchronous events;
FIG. 10a illustrates an example specification of a proxy object definition for an external entity that extends the proxy object definition of FIG. 5 by customizing the default values of its properties;
FIG. 10b illustrates an example specification of a proxy object definition that extends an existing proxy object definition by declaring a new function and associated default property settings;
FIGS. 11a-11b illustrate the operational flow of the relevant aspects of the enhanced compiler of FIG. 2, in accordance with one embodiment;
FIG. 12 illustrates the proxy object of FIG. 2 in further detail in accordance with one embodiment.
FIG. 13a illustrates the operational flow of the relevant aspects of the runtime environment of FIG. 2, in accordance with one embodiment;
FIG. 13b illustrates an example execution flow;
FIGS. 14a-c illustrate specifications for declaring a proxy object factory, using a proxy object factory to create proxy objects and handling asynchronous events associated with generated proxy objects; and
FIG. 15 illustrates an example computer system suitable for use to practice the present invention, in accordance with one embodiment.



DETAILED DESCRIPTION OF THE INVENTION
The present invention includes a method and apparatus for simplifying the development, customization and use of proxy objects as software abstractions for interacting with external entities from within a software application.
In the following description, various aspects of the present invention will be described. However, it will be apparent to those skilled in the art that the present invention may be practiced with only some or all aspects of the present invention. For purposes of explanation, specific numbers, materials and configurations are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that the present invention may be practiced without the specific details. In other instances, well-known features are omitted or simplified in order not to obscure the present invention.
Terminology
Parts of the description will be presented in data processing terms, such as data, selection, retrieval, generation, and so forth, consistent with the manner commonly employed by those skilled in the art to convey the substance of their work to others skilled in the art. As well understood by those skilled in the art, these quantities take the form of electrical, magnetic, or optical signals capable of being stored, transferred, combined, and otherwise manipulated through electrical and/or optical components of a processor and its subsystems.
Part of the descriptions will employ various abbreviations, including but are not limited to:
















URL
Uniform Resource Locator



XML
eXtended Markup Language










The term “external entity” as used in the application (including the claims) to refer to “external” hardware as well as software entities. “External” is viewed from the perspective of the software application interacting with the entity.
Section Headings, Order of Descriptions and Embodiments
Section headings are merely employed to improve readability, and they are not to be construed to restrict or narrow the present invention.
Various operations will be described as multiple discrete steps in turn, in a manner that is most helpful in understanding the present invention, however, the order of description should not be construed as to imply that these operations are necessarily order dependent. In particular, these operations need not be performed in the order of presentation.
The phrase “in one embodiment” is used repeatedly. The phrase generally does not refer to the same embodiment, however, it may. The terms “comprising”, “having” and “including” are synonymous, unless the context dictates otherwise.
Overview
FIG. 2 illustrates an overview of the present invention, in accordance with one embodiment. As illustrated, to simplify developing software applications 240 that interact with external entities 202, the present invention provides methodologies and facilities to provide proxy objects 254 for external entities 202, such that software application 240 may interact with external entity 202 programmatically using general purpose programming concepts familiar to software developers.
More specifically, a developer may create a proxy object definition 204 for external entity 202. The developer may be the developer of external entity 202, a third party developer, or even the developer of application 240.
Proxy object definition 204 includes interface declaration 205 identifying that a proxy object 254 should be generated based on the definition for interacting with an external entity. Further proxy objection definition 204 includes default property settings 206 for defining the default behavior and default implementation 210 of proxy object 254, callback declarations 208 for handling asynchronous events from external entity 202 and function declarations 209 for initiating interactions with external entity 202.
In one embodiment, the one or more proxy object implementation classes 210 include a run-time implementation class. In another embodiment, the one or more implementation classes 210 further include a compile-time implementation class. In yet another embodiment, implementation classes 210 further include a design-time implementation class.
The run-time implementation class provides the run-time implementations for the functions declared in proxy object declaration 204 and used by software application code 220 to interact with external entity 202 programmatically. The run-time implementation class may provide one or more built-in functions 211 for initiating interaction with external entity 202 and one or more built-in callbacks 212 for handling asynchronous events generated by external entity 202.
The optional compile time implementation class provides the compile time validation implementation to assist compiler 230 in validating usage of the functions and property settings by proxy object definition 204 and by application code 220, during compilation.
The optional design-time implementation class provides the design-time implementation for assisting developers of proxy object definitions 204 and application code 220. It assists developers to extend and use properties and functions implemented by the run-time implementation for interacting with external entity 202 programmatically. An example of such design-time implementation includes but is not limited to a graphical wizard that guides the developer through the creation of a proxy object definition for a specific external web service given the WSDL description of that web service. Another example is the provision of graphic icons corresponding to usage of the functions of proxy object definition 204, which when selected for a application code 220, inserts the corresponding function call into the application code 220.
For the illustrated embodiment, the proxy object implementation 210 may implement one or more interfaces 214-218. In particular, for the embodiment, proxy object implementation 210 may implement builder interface 214, resource interface 216, and extensible interface 218.
Builder interface 214 may be implemented by the compile-time component of proxy object implementation 210 to assist compiler 230 in validating the usage of properties and functions implemented by proxy object implementation 210. Resource interface 216 may be implemented by the run-time component of proxy object implementation 210 to acquire and release critical resources, such as databases and file handles, needed by the proxy object implementation. Extensible interface 214 may be implemented by the run-time component of proxy object implementation 210 to enable proxy object definitions 204 to declare new functions not built-in to proxy object implementation 210.
Still referring to FIG. 2, once proxy object definition 204 and implementation 210 are created, a developer of application code 220 may equip application 240 to initiate interactions with external entity 202 by including proxy object declarations 222 and invoking declared functions 209 on the resulting proxy objects. Application code may also include property settings 223 to customize the behavior of proxy objects or include event handlers 224 to process asynchronous events generated by external entity 202.
Software application code 220, proxy object definitions 204, and proxy object implementations 210 equipped in accordance with the present invention are compiled into application 240, proxy objects 254, and meta-data 252 using enhanced compiler 230.
Compiler 230 is enhanced to recognize proxy object definitions 204 and generate associated proxy objects 254 using proxy object implementations 210 to facilitate interaction with software entity 202 at runtime. Compiler also generates proxy initialization code 242 that creates a proxy object for each proxy object declaration 222, assigns the proxy object to the declared variable, and registers the proxy object with asynchronous event router 256 to receive appropriate events generated by the associated external entity 202. Further, compiler 230 is enhanced to gather and output meta-data 252 describing the interfaces, functions, callbacks and property settings of property object definitions 204 for use by the corresponding proxy object 254 at runtime.
Still referring to FIG. 2, execution of compiled object code during runtime is under the control of runtime engine 250. Runtime engine 250 includes in particular, proxy context objects 258, an instance of which is created for each proxy object invocation for interacting with an instance of external entity 202 and maintaining the state information of the particular interaction. For the embodiment, interaction context 258 includes a number of methods through which proxy object implementation 210 may obtain information about a particular interaction.
For the embodiment, as described earlier, proxy object definition 204 may declare one or more callback functions 208 for handling asynchronous events generated by corresponding external entity 202. Complementarily, runtime engine 250 includes asynchronous event router 256 for listening for, receiving, and routing asynchronous events generated by external entity 202 to appropriate proxy objects 254 for processing by event handling code 246 of application 240. The locations listened to by asynchronous event router 256 are specified by proxy initialization code 242 based on proxy object implementation 210 and associated property settings 204 and 223.
Using the mechanisms described above, developers may create application code 220 to interact with external entities 202 by invoking functions on declared proxy objects 222, setting proxy object properties 223 and defining event handlers 224. Interacting with external entities in this way is very similar to interacting with other software objects and does not require the developer to learn excessive new paradigms, skills and/or techniques. In addition, developers may create new proxy object definitions 204, even with new functions and callbacks without specifying the implementation of the new functions or callbacks. The resulting proxy objects 254 in cooperation with run-time engine 250 handle multiple simultaneous and asynchronous interactions with external entity 202.
In various embodiments, the external entity 202 may be a web service, a database, or a legacy system, as well as physical objects.
Provision of the optional design time implementation class is not an essential aspect to practice the present invention. Moreover, it is within the ability of those ordinarily skilled in the art, thus will not be further described. Other aspects of the present invention will be further described in turn below.
Proxy Object Definition
FIG. 3 illustrates the operations a developer or design-time tool may take to develop a proxy object definition 204 of the present invention in further detail, in accordance with one embodiment. As illustrated, and alluded to earlier, one of the actions to be taken to create proxy object definition 204 is to specify a proxy object interface declaration 205, block 302.
In one embodiment, this is achieved by declaring that proxy object definition 204 extends a special “proxy object” marker interface (402 of FIG. 4). As illustrated in FIG. 4, the extension of the marker interface 402 may be direct, as in the cases of proxy object definitions 404a-404b or indirect, as in the cases of proxy object definitions 404c-404i. At compile-time, enhanced compiler 230 will identify proxy object definitions 204 by finding interfaces that extend marker interface 402 and will generate proxy objects for each such interface. If the extension of the marker interface 402 is indirect, proxy object definition 204 will inherit the functions, properties and callbacks of the other proxy object definitions it extends (e.g., proxy object definition 404i will inherit the functions, properties and callbacks defined by proxy objects 404c and 404a).
Referring back to FIG. 3, as illustrated, and alluded to earlier, another action to be taken to create proxy object definition 204 is to specify the default property settings for the proxy object definition, block 303. These settings will be used at run-time by proxy object implementation 210 to determine the behavior of proxy object 254.
Further, the programmer or design-time tool may optionally specify function declarations 209 of proxy object definition 204, block 304. Application code 220 may use the declared functions to programmatically interact with external entity 202. Function declarations 209 may correspond to built-in functions 211 of proxy object implementation 210, or if proxy object implementation 210 implements extensible interface 214, function declarations 209 may introduce new functions not provided explicitly by proxy object implementation 210.
In addition, the programmer or design-time tool may optionally specify callback function declarations 208 representing asynchronous events that may be generated at run-time by external entity 202. Callback function declarations 208 may correspond to built-in callback functions 212 of proxy object implementation 210, in which case proxy object 254 will route corresponding asynchronous events generated by external entity 202 to proxy object implementation 210 for processing (which may, in turn, route them to event handling code 246 of application 240). When callback function declarations 208 do not correspond to built-in callback functions 212 of proxy object implementation 210, proxy object 254 will route corresponding asynchronous events generated by external entity 202 directly to event handling code 246 of application 240.
Further, the developer or design-time tool may specify the implementation classes of the proxy object definition 204, which includes the runtime implementation class, and optionally, the compile time implementation class and/or the design time implementation class, block 306. Proxy object definition 204 need not specify implementation classes if it extends another proxy object definition that specifies implementation classes. In this case, the implementation class specifications are inherited from the extended proxy object definition.
In one embodiment, specifications of the implementation classes are made using property settings. In one embodiment, property settings are specified in an annotation form, i.e. in what is conventionally considered to be comments of a source file.
FIG. 5 illustrates an example proxy object definition of an external timer entity. Those skilled in the art will recognize this as a familiar Java interface definition extending an existing interface called com.bea.jws.ProxyObject on line 502 and including some special JavaDoc comments on lines 510-516. The Timer interface is identified as a proxy object definition of the present invention through declaration 502 specifying the Timer interface extends the “ProxyObject” marker interface of the present invention. In this case, the Timer interface extends the ProxyObject marker interface directly; however, it is also possible to extend the ProxyObject marker interface indirectly as depicted in FIG. 4.
Further, the Timer interface is specified as having a setTimeoutIn(int milliseconds) function 504a, a setTimeoutAt(java.util.Date date) function 504b, and so forth for application code 220 to set an “alarm” after n elapsed units of time or at a specific moment in time.
In addition, the Timer interface includes a callback function 504c for handling alarm events generated by external entity 202 e.g., by passing them to application 240 asynchronously, when the timer expires at the requested time. In one embodiment, callback declarations are functions defined in a nested interface named “Callback” as depicted in FIG. 5.
The runtime, compile time and design time implementation classes are specified as “com.bea.jws.private.TimerImpl” 512, “com.bea.jws.private.TimerValidator” 514, and “com.bea.jws.private.TimerDesigner” 516 respectively. The specifications are made using property settings. In one embodiment, property settings are specified in an annotation form in a comment section. As those skilled in the art will recognize, property settings in this example are specified using the special Javadoc annotation @implementation 510.
Proxy Object Implementation
Except for the exploitation of extensible, resource and/or builder interfaces 214-218, usage of proxy context object 258, and implementation of facilities in conformance to the expected execution paradigm, the core constitution of each implementation class, whether it is runtime, compile time, or design time, is application dependent. That is, they vary depending on the behavior of and services offered by external entity 202, and the nature of the functions.
However, as alluded earlier, the runtime implementation class is expected to implement the functions of the proxy object definition 204 in the execution context of the present invention either directly through built-in functions 211 or indirectly through the “invoke” function of extensible interface 218.
FIG. 6 illustrates proxy object implementation 210 in further detail, in accordance with one embodiment. As illustrated, for the embodiment, proxy object implementation 210 includes built-in functions 211, built-in callback functions 212, builder interface 214, resource interface 216 and extension interface 218.
As described earlier, builder interface 214, when implemented by a compile time implementation class, assists compiler 230 to validate the properties defined by the proxy object definition 204 and used by application code 220 are supported by proxy object implementation 210. In addition, builder interface may be used by an integrated development environment to help the developer understand where and how properties may be used.
Resource interface 216, when implemented by a runtime implementation class, assists the runtime implementation class in acquiring and releasing resources, such as database connections and file handles.
Extensible interface 218, when implemented by a runtime implementation class, enables proxy object definitions 204 to declare new functions, not directly supported by proxy object implementation 210, without defining how those functions are implemented.
For the illustrated embodiment, builder interface 218 includes in particular a Get Property Syntax function 602, Validate Class Properties function 604, and Validate Field Properties function 606. As the names of these functions suggest, when invoked, these functions return a description of the valid property syntaxes for the proxy object and validate the class and field level properties of the proxy object.
In one embodiment, when invoked, Get Property Syntax function 602 returns a URL identifying a file provided by the developer of the compile time implementation class, describing the valid property syntax in the form of a XML file.
An example snippet of such a XML file is illustrated in FIG. 7. As illustrated, such snippet may specify the name of a property, 702a or 702b, the attributes of a property, 704a, 704b, or 704c, including whether they are required, the data type of the attribute values 706, and if applicable, their default values 708.
For the example snippet, it specifies that the “@sql” property is only allowed in front of proxy object definition functions 208, and the presence of the property is required here. The @sql property may have statement, maxcount, and returnType attributes. The statement attribute is required. Unless specified otherwise, all attributes must be assigned values. Maxcount and returntype are optional. Maxcount takes an integer value, and the default value is infinity. Unless specified otherwise, attributes (such as Statement and returntype) take string values, and the default value is the empty string. The @pool annotation is allowed in front of proxy object declarations 222, proxy object definition functions 209, and proxy object definitions 204, and is optional in all these locations. Finally, the @pool annotation can have a name attribute, which should be present and have a string value.
In alternate embodiments, the information may be provided and/or returned in other formats or using other data organization techniques.
Implementations of Get Propoerty Syntax function 602, Validate Class Properties function 604, and Validate Filed Properties function 606 are within the ability of those skilled in the art, accordingly will not be further described.
Implementing the builder interface 218 enables a compile time implementation class to use these functions to provide the expected syntax, and to validate the meta data, for compiler 230.
Referring back to FIG. 6, for the illustrated embodiment, resource interface 216 includes an Acquire Resource function 612 and Release Resource function 614. As the names of these functions suggest, function 612 enables proxy object implementation 210 to acquire system resources, such as database connections and files handles, needed by the implementation before the run-time creates each new instance of a proxy and function 614 enables proxy object implementation 210 to release resources after the run-time destroys each instance of a proxy object. Similarly, implementations of Acquire Resource function 612 and Release Resource function 614 are within the ability of those skilled in the art, accordingly will not be further described.
Still referring to FIG. 6, for the illustrated embodiment, extension interface 214 includes an Invoke Object function 616. Invoke object function 616 is designed to handle invocation of custom methods declared by proxy object definitions 204. Thus, proxy object definitions 204 may declare new functions 209 not specifically implemented by built-in functions 211 of proxy object implementation 210. During runtime, when application code 220 invokes new functions 209, proxy object 254 will dispatch them to invoke function 616 of proxy object implementation 210. Invoke function 616 of proxy object implementation 210 may access the name, arguments, return type, properties and other meta-data related to proxy object invocation 244 via proxy context object 258 to determine the desired semantics of the invoke operation. The access may be made using e.g. methods associated with proxy context object 258.
Similarly, implementation of Invoke Object function 616 is within the ability of those skilled in the art, accordingly will not be further described.
Developing Application
FIG. 8 illustrates the application development method of the present invention, including usage of software abstractions for external entities, in accordance with one embodiment. As illustrated, at block 801, a proxy object implementation 210 is first created optionally including built-in functions, built-in callbacks, builder interface implementation, resource interface implementation and/or extensible interface implementation.
Then, at block 802, a proxy object definition 204 is created, extending the marker ProxyObject interface directly or indirectly through another proxy object definition. If proxy object definition extends ProxyObject marker interface directly it specifies the associated proxy object implementation 210 e.g. using an “implementation” property. A proxy object definition that extends the ProxyObject marker interface indirectly may also specify an associated implementation overriding the implementation associated with its base class. The proxy object definition may also specify new default property values and if implementation 210 is extensible specify new functions and callbacks. The proxy object definition may be made by the developer of application 220, developer of proxy object implementation 210 or another independent third party. As described earlier, a proxy object definition 204 is extensible if the associated implementation 210 implements extension interface 214. Example extensions will be described below referencing FIGS. 10a-10b. 
At block 804, a developer of application 220 inserts one or more proxy object declarations 222 into application code 220 referencing proxy object definition 204. As alluded to earlier, the proxy object definition 204 may be the base proxy object definition 204 e.g. offered by the developer of the software abstraction of external entity 202 or it may be a customized version of the proxy object definition 204. An example declaration will be described below referencing FIG. 9a. 
At block 806, a developer of application 220 specifies values for applicable ones of the properties of the proxy object definition 204. In one embodiment, the specification is in annotation form within a comment section of the source file. An example specification will be described below referencing FIG. 9b. 
Having inserted proxy object declarations 222, and for applicable ones, if any, the property values, at block 808, an application 220 may interact with external entity 202 programmatically, using the functions defined by proxy object definitions 204 and implemented by implementation 210 either directly using built-in functions 211 or indirectly by the extensible interface 218.
As alluded to earlier, a developer of application 220 may also specify a handler for asynchronous events generated and sent by an asynchronous event generation function of the software abstraction of external entity 202. An example specification will be described below referencing FIG. 9c. 
Customizing Proxy Object Properties
FIG. 10a illustrates a simple proxy object definition 204 that extends the example Timer interface shown in FIG. 5 by specifying a new interface declaration 1002 and a new default property setting 1004. The StandardTimer proxy object definition of FIG. 10a inherits all the functions and properties defined by the proxy object definition in FIG. 5, but changes the default setting for the “timeoutIn” attribute of the @Timer property to 30 seconds. Consequently, applications 220 that use the StandardTimer will not need to specify the timeoutIn attribute or the @Timer property if 30 seconds is acceptable.
Those skilled in the art of course will recognize that the above example is purposely kept simply to facilitate illustration and ease of understanding. In practice, a proxy object definition of the present invention may customize default property settings much more extensively. In particular, a proxy object definition may also customize properties associated with property object functions and callbacks. In addition, property object definitions may be customized multiple times successively, that is a customized property object definition may itself be further customized.
Customizing Proxy Object Interfaces
When a proxy object implementation 210 implements extensible interface 214, it is also possible to customize the interface of associated proxy object definitions 204 by adding new function declarations 209 and callback declarations 208. FIG. 10b illustrates an example proxy object definition 1020 named EmployeeDB that customizes the com.bea.jws.Database proxy object definition by declaring a new function named getEmployeeData. The interface declaration 205 on line 1022 declares that the EmployeeDB interface extends the com.bea.jws.Database interface, which in turn extends the com.bea.jws.ProxyObject interface (not shown) identifying the EmployeeDB interface as proxy object definition of the present invention. As such, the EmployeeData interface will inherit all the property settings, functions and callbacks declared in the Database proxy object definition and all proxy object definitions it extends.
Line 1028 is a function declaration adding the function getEmployeeData to the existing list of functions inherited from the Database proxy object definition. This function may be invoked by application 240 at run-time to interact with the external employee database described by proxy object definition 1020. Note, however, that none of the proxy object definitions or proxy object implementation specifically implement the getEmployeeData function. The details of exactly how invocations to functions 209 declared by proxy object declarations 204 are handled at run-time is further specified below.
Line 1026 is a property setting describing the desired semantics of the getEmployeeData function and line 1024 defines the EmployeeRecord data structure returned by the getEmployeeData function. All interface declarations 205, property settings 206, callback declarations 208, function declarations 209 and associated definitions (e.g., the EmployeeRecord data structure) are stored by compiler 230 in meta-data 252 and available to proxy object 254 at run-time via proxy context object 258. This meta-data assists proxy object 254 and proxy object implementation 210 to provide implementations of functions 208 and callbacks 209 declared by proxy object definitions 204.
Using Proxy Objects
FIG. 9a illustrates an example proxy object declaration 222 as it might be found in application code 220. Line 902 declares a new proxy object named the timer that implements the com.bea.jws.Timer proxy object definition from FIG. 5.
FIG. 9b illustrates an almost identical example proxy object declaration with the timeoutIn attribute of the @Timer property set to the value 30 sec, 904. In this example, the value of the timeoutIn property is specified as a Javadoc annotation in a comment section. Application code 220 may invoke functions on this object to interact with the associated external timer entity. In addition, the developer of application code 220 may specify handlers for asynchronous events generated by external entity 202.
FIG. 9c illustrates one such example asynchronous event handler for handling asynchronous timeout event notifications 906. In this example, the handler is written as a specially named function in application code 220. The function name is formed by appending the name of the asynchronous event to be handled (i.e., “ontimeout”) to the name of the associated proxy object (i.e., “theTimer”). As we will see below, at run-time, proxy object 254 will forward asynchronous events to the appropriate event handling code 246 in application 240.
Compile-time
FIGS. 11a-11b illustrate the operational flow of the relevant aspects of compiler 230, in accordance with one embodiment. As illustrated first by FIG. 1a, at block 1102, compiler 230 parses the source statements of application code 220 to determine the language elements present in the source statements. In particular, compiler 230 determines if any proxy object declarations of the present invention are included in application code 220 by looking for objects declared to implement interfaces derived from proxy object marker interface 402, block 1104.
If no proxy object declarations of the present invention are found, application code 220 is compiled as other software entities in the prior art, block 1106. The exact nature of this compilation is language and compiler implementation dependent.
If at least one proxy object declaration of the present invention is found, compiler 230 gathers the meta data necessary to describe each proxy object of the present invention, block 1108.
In one embodiment, the meta data gathering operation includes identifying and extracting property settings 223 from application code 220 and default property settings 206 from all associated proxy object definitions 204, including proxy object definitions from which the proxy object definitions identified in proxy object declarations 222 are derived. In addition, meta data gathering includes identifying and extracting the names and signatures of declared interfaces 205, declared functions 209 and declared callbacks 208 from all associated proxy object definitions 204 as well as the names and signatures of built-in functions 211 and built-in callbacks 212 of proxy object implementation 210.
In one embodiment, property settings are specified using a Javadoc annotation form in the comment sections of the source file of application code 220 and proxy object definitions 204. Compiler 230 includes a property processor (not shown) responsible for parsing the comment sections of the source file of application code 220 and proxy object definitions 204.
In one embodiment, consultation with the compile time implementation class is also performed by the property processor of compiler 230 to verify the property settings and associated properties are implemented and allowed by proxy object implementation 210. In one embodiment, the consultation is made through the functions of builder interface 218.
Upon gathering up the meta data necessary to describe each proxy object of the present invention, compiler 230 outputs one or more meta data files 252 containing the gathered meta data, block 1110, for use by the corresponding proxy object 254 during runtime.
Then, compiler 230 generates a proxy object 254 for each proxy object definitions 204 associated with (e.g., referenced by) proxy object declarations 222 to facilitate the interaction between the application 240 and the external entity 202. This process is described in more detail below referencing FIG. 11b. 
Further, compiler 230 generates proxy initialization code 242 for each proxy object declaration 222, block 1124. At run-time, each instance of proxy initialization code 242 creates a proxy object implementing the interface identified in the associated proxy object declaration 222, assigns the proxy object to the proxy object variable identified in the associated proxy object declaration 222 and registers the proxy object with asynchronous event router 256 to receive all asynchronous events from associated external entity 202.
Next, compiler 230 compiles the rest of the application code 220 as in the prior art inserting proxy initialization code 242 to run prior to associated proxy invocation code 244 and event handling code 246, block 1106. The manner the compilation is performed is language and compiler dependent.
Further, implementation of the property processor is within the ability of those skilled in the art, and will not be further described.
FIG. 12 illustrates proxy object 254 generated by compiler 230 in more detail. Proxy object 254 includes function interfaces 1222-1224 and callback interfaces 1226-1228 declared by proxy object definitions 204 and represented by black circles in FIG. 12. In addition, proxy object 254 includes proxy object implementation 210, including built-in functions 211 and built-in callbacks 212 represented by white circles in FIG. 12. If proxy object implements extensible interface 216, proxy object implementation also includes invoke function 616 for handling invocations to function interfaces 1224 that don't have a corresponding built-in function 211.
Further, Proxy object 254 and proxy object implementation 210 have access to meta-data 252 via proxy object context 258 describing associated proxy object definitions 204 (including interface declarations, property settings, callback declarations and function declarations) and property settings 223. This meta-data may be used at runtime to determine the desired semantics of invocations to function interfaces 1224 that don't have a corresponding built-in function 211. In one embodiment, a reference to proxy object context 258 may be obtained by calling the global function getProxyContext( ) provided by runtime engine 250. At run-time, the getProxyContext( ) function will return the proxy object instance associated with the current proxy object invocation as described further below.
As described earlier, in various embodiments, proxy object context 258 includes various methods for facilitating access of the “context” information. In one embodiment, these methods include a getMetaData( ) method for getting meta data, and a getattribute( ) method for getting particular property values. Meta data may e.g. include methods, arguments, fields, and/or annotations associated with the proxy object functions and callbacks.
In one embodiment, proxy object context 258 also includes a getInstanceID( ) to facilitate obtaining the unique ID of the proxy object instance, and a sendEvent( ) for sending asynchronous events to application 240. In one embodiment, sendEvent( ) determines the appropriate event handler 246 to invoke by appending the name of the event to the name of the proxy object variable specified in proxy object declaration 222. It extracts the event name and proxy object variable name from meta-data 252. Implementation of these methods are within the ability of those skilled in the art, accordingly will not be further described. In alternate embodiments, the present invention may be practiced with more or less methods associated with proxy object context 258.
As described earlier, at block 1112, compiler 230 generates proxy object 254, more specifically, using information collected from application code 220, proxy object definitions 204 and proxy object implementation 210. As illustrated in FIG. 11b, it generates a proxy object function 1222 for each function declaration 209 in proxy object definitions 204 that have a corresponding built-in function 211 in proxy object implementation 210, block 1122. Each implementation of proxy object functions 1222 simply calls the corresponding built-in function 211 of proxy object implementation 210 passing in provide parameters and returns the result.
If proxy object implementation 210 implements extensible interface 214, compiler 230 also generates proxy object functions 1224 for each function declaration 209 in proxy object definitions 204 that do not have a corresponding built-in function 211 in proxy object implementation 210, block 1124. Each implementation of proxy object functions 1224 invokes “invoke” function 616 passing the list of provided parameters and returns the result.
Similarly, compiler 230 generates proxy object callback functions 1226 for each callback declaration 208 in proxy object definitions 204 that have a corresponding built-in callback 212 in proxy object implementation 210, block 1126. Each implementation of callback functions 1226 simply calls the corresponding built-in callback 212 passing provided parameters and returning any results.
Further, for each callback declaration 208 in proxy object definitions 204 that does not have a corresponding built-in callback 212 in proxy object implementation 210, compiler 230 determines whether an appropriate event handler 246 exists in application 240 to handle the call back, block 1128. If an appropriate event handler 246 exists, compiler 230 generates a proxy callback function 1228, which, invokes the appropriate event handler 246 passing in provided parameters and returns any results generated by the event handler, block 1128. If an appropriate event handler does not exist, compiler 230 generates and error, block 1128. In one embodiment, compiler 230 identifies the appropriate event handler and determines its existence by searching for a function in application 240 with a special name formed by appending the name of the associated event to the name of the associated proxy object variable specified in proxy object declaration 222. The names of the appropriate event and proxy object variable are extracted from meta-data 252.
Run-time
FIG. 13a illustrates the relevant operational flow of runtime engine 250, in accordance with one embodiment. When the runtime engine 250 is first instantiated, it initializes the runtime environment, including in particular, the creation of an instance of asynchronous event router 256, block 1302. In one embodiment, asynchronous event router 256 is a server component that listens for messages using various networking protocols and forwards them to clients that have registered for events with matching characteristics (e.g., based on message address or content). In one embodiment, asynchronous event router 256 is a Java Servlet that listens for XML messages using Internet protocols, such as HTTP. In one embodiment, event router 256 listens for messages using queuing protocols, such as JMS.
Additional non-essential details of runtime engine 250 may be found in copending U.S. patent application Ser. No. 10/082,807, entitled “ANNOTATION BASED DEVELOPMENT PLATFORM FOR ASYNCHRONOUS WEB SERVICES”, filed on Feb. 22, 2002, having at least partial common inventorship with the present application. The '807 specification is hereby fully incorporated by reference.
Upon initialization of the runtime environment, runtime engine 250 waits for requests to execute applications, block 1304. At block 1306, runtime engine 250 loads application 240, whose execution is requested (or creates a new instance of the application if the application has been previously loaded for an earlier execution request). After loading and/or creating an instance of application 220, execution engine 250 “executes” the application 220, or more specifically, transfers execution control to application 220.
FIG. 13b illustrates a typical execution flow, in accordance with one embodiment. As designated by compiler 230, if application 240 includes proxy initialization code 242 and so forth, proxy initialization code 242 executes prior to proxy invocation code 244 and event handling code 246.
As previously described, proxy initialization code 242 instantiates a proxy object for each proxy object declaration 222 and assigns the proxy object to the associated variable specified in proxy object declaration 222, block 1312. Then, proxy initialization code 242 registers all callbacks functions 208 declared in associated proxy object definitions 204 and implemented by proxy object 254 with asynchronous event router 256 as handlers for asynchronous events from external entity 202, block 1314.
Thereafter, execution engine 250 continues to execute application 240,. In the course of execution, if application 240 has a need to interact with external entities, it invokes proxy object functions 1222-1224 using the associated variable declared in proxy object declaration 222, block 1318. As designated by compiler 230, proxy object functions 1222-1224 create an instance of proxy context object 258 associated with the invoked function using a function invocation ID. In one embodiment a separate thread is created for each function invocation and the thread ID is used as the function invocation ID.
Functions 2222 further invoke associated built-in functions 211 of proxy object implementation 210, block 1318. The behavior of built-in functions 211 varies for each proxy object implementation 210 and depends largely on the nature of associated external entity 202. If provided, proxy object functions 1224 invoke the “invoke” function 616 of proxy object implementation 210, block 1318.
In one embodiment, built-in functions send messages to external entity 202 via Internet or messaging protocols and optionally wait for a response. In one embodiment, if a response is received, built-in function 211 returns a representative result, which is in turn returned to proxy invocation code 244 inside application 240 by proxy object function 1222. In one embodiment, built-in functions include a callback location and proxy object instance identifier in messages sent to external entity 202 to facilitate the generation and routing of callback events generated by external entity 202.
Both built-in functions 211 and the “invoke” function 616 of extensible interface 218 may obtain a reference to the current proxy context object 258 for accessing meta-data 252 by calling the global getProxyContext( ) function provided by run-time engine 250. The getProxyContext( ) function finds and returns the appropriate context object based on the invocation ID associated with the current function invocation. In one embodiment, a separate thread is created for each function ID and the current invocation ID is the same as the current thread ID.
Like built-in functions 211, the behavior of invoke function 616 varies for each proxy object implementation 210 and depends largely on the nature of the associated external entity 202. In one embodiment, invoke function 616 accesses meta-data 252 via proxy context object 258 to determine the desired semantics of proxy object functions 1224, then sends appropriate messages to external entity 202, optionally waits for a response and returns a representative result to proxy object function 1224, which in turn returns the result to proxy invocation code 244 in application 240. In one embodiment, invoke function 616 includes a callback location and proxy object instance identifier in messages sent to external entity 202 to facilitate the generation and routing of callback events generated by external entity 202.
Upon receiving a request from application 240, external entity 202 handles the request in an application dependent manner and optionally records a callback address and instance identifier provided by the request. External entity 202 may generate asynchronous events detectable by asynchronous event handler 256 and may specify the recorded callback address and instance identifier to facilitate handling of the event. In one embodiment, external entity 202 provides event notifications to asynchronous event router 256 in the form of messages.
At block 1320, as asynchronous event router 256 detects an event from external entity 202, it checks its list of registered handlers and invokes the designated callback function 1226-1228 of the designated proxy object passing a representation of the event as a set of parameters. In one embodiment, asynchronous event router 256 uses a provided callback location to identify which registered handler and callback function should handle the event. In one embodiment, asynchronous event router 256 uses a provided instance identifier to determine which instance of the identified handler should receive the callback.
As designated by compiler 230, at block 1324, proxy object callbacks 1226 invoke associated built-in callbacks 212 of proxy object implementation 210 passing along any provided parameters, block 1322. The behavior of built-in callbacks 212 varies for each proxy object implementation 210 and depends largely on the nature of associated external entity 202.
In one embodiment built-in callback 212 may invoke an appropriate event handler 246 in application 240 passing provided parameters and optionally wait for a response, block 1322.
Upon receipt of a response to the event for external entity 202, built-in callback 212 returns any returned result to proxy object callback function 1226, which returns it to asynchronous event router 252, which provides the result to external entity 202, block 1324. In one embodiment, the result is returned to the external entity in the form of a representative message.
Also as designated by the compiler, proxy object callbacks 1228 do not have corresponding built-in callbacks 212 and are therefore forwarded directly to appropriate event handlers 246 with any corresponding results returned optionally to external entity 202 via proxy callback function 1228 and asynchronous event router 256, block 1324.
In one embodiment, appropriate event handlers 246 are identified as specially named functions defined in application 240. In one embodiment, this naming convention is determined by appending the name of proxy callback function 1226-1228 corresponding to callback declarations 208 to the name of the proxy object variable declared in proxy object declaration 222 in application code 220.
Managing N-way Relationships
For some applications, there is a need to manage an n-way interaction with an external entity. I.e., a single instance of application 240 may need to simultaneously interact with multiple instances of external entity 202. The required number of instances may vary based on run-time data; therefore, it may not be possible to determine how many proxy object instances will be required when application code 220 is written. For example, an application instance may have a need to disassemble the line items of a purchase order and conduct a concurrent conversation with a separate instance of the external entity for each line item.
In various embodiments, to address this need, the application developer may specify a proxy object factory in proxy object declaration 222 instead of specifying a single proxy object. For these embodiments, compiler 230 automatically generates a “factory class” for each proxy object 254. For example, for a proxy object 254 named MyService, a factory class (not separately shown) by the name MyServiceFactory is automatically generated. FIG. 14a illustrates an example proxy object factory declaration in one embodiment corresponding to the “Timer” proxy object definition illustrated in FIG. 5.
In some or all of these embodiments, the automatically generated proxy object factory may include a create( ) function to enable application 240 to control the creation of new proxy object instances and a destroy( ) function to enable application 240 to control the destruction of previously created proxy object instances. As such, application 240 may create as many instances of the proxy object as required at run-time. FIG. 14b illustrates how application code 220 might use the creates function in one embodiment to generate a new instance of the “Timer” proxy object and use the resulting proxy object to interact with the associated external entity.
Each automatically generated proxy object factory may be used by a software application to interact with the corresponding external entity in a n-way interaction, substantially as earlier described for the singleton case, referencing FIGS. 9a-9c. The proxy object factory behaves as if the annotations (i.e. usage specifications) were in front of instances created by the proxy object factory.
To facilitate proper asynchronous event routing, developer of application code 220 names associated event handlers 224 using the name of the proxy object factory variable instead of a proxy object variable name. In addition, the developer specifies a “proxy object instance” variable as a predetermined parameter, e.g. the first parameter, of each event handler 224. Proxy object 254 will provide the appropriate proxy object instance for each callback event, so application 240 may determine which instance of external entity 202 generated the event and interact with it using the provided proxy object instance. FIG. 14c illustrates an event handler 224 in one embodiment developed to handle asynchronous events from Timer proxy objects generated by the proxy object factory named “manyTimers” declared in FIG. 14a. As illustrated, on invocation, the first argument “t” will reference the specific instance of the Timer proxy object associated with the instance of the external entity that generated the event.
Example Computer System
FIG. 15 illustrates an example computer system suitable for use to practice the present invention, in accordance with one embodiment. Depending on the size, capacity or power of the various elements, example computer system 1500 may be used to host the software abstraction of an external entity 202, and/or implementations of the software abstractions of external entities 202 during runtime.
Example computer system 1500 may also be used to host the development of application 220 that programmatically interacts with abstracted external entity 202, including its compilation, or execution of application 240 during runtime.
As shown, computer system 1500 includes one or more processors 1502, and system memory 1504. Additionally, computer system 1500 includes mass storage devices 1506 (such as diskette, hard drive, CDROM and so forth), input/output devices 1508 (such as keyboard, cursor control and so forth) and communication interfaces 1510 (such as network interface cards, modems and so forth). The elements are coupled to each other via system bus 1512, which represents one or more buses. In the case of multiple buses, they are bridged by one or more bus bridges (not shown).
Each of these elements performs its conventional functions known in the art.
In particular, system memory 1504 and mass storage 1506 are employed to store a working copy and a permanent copy of the programming instructions implementing the various aspects of the present invention, i.e. the software abstractions of external entities 202, implementations of the software abstractions 210, applications 220, compiler 230, and/or runtime engine 250. The permanent copy of the programming instructions may be loaded into mass storage 1506 in the factory, or in the field, through e.g. a distribution medium (not shown) or through communication interface 1510 (from a distribution server (not shown)).
The constitution of these elements 1502-1512 are known, and accordingly will not be further described.
Conclusion and Epilogue
Thus, it can be seen from the above descriptions, a novel method and apparatus for simplifying the development, customization and use of software abstractions for interacting with external entities from within a software application has been described. The present invention advantageously assists a software developer to develop software that interacts with a variety of other external entities, without necessarily requiring the software developer to learn a large number of new paradigms or acquire a large number of new techniques.
While the present invention has been described in terms of the above described embodiments, those skilled in the art will recognize that the invention is not limited to the embodiments described. The present invention can be practiced with modification and alteration within the spirit and scope of the appended claims. Thus, the description is to be regarded as illustrative instead of restrictive on the present invention.

## Claims

1. A compile-time environment comprising:
a processor; and a compiler coupled to and operated by the processor, the compiler to parse a software application in source form, including parsing logic to discern and comprehend a proxy object declaration, and in response, gather (1) one or more declarative annotations from the software application, the declarative annotations including proxy object settings of a proxy object, and (2) a proxy object definition defining the proxy object, the proxy object abstracting an external entity, and the proxy object is to be generated to assist the software application in interacting with the entity, the proxy object definition identifying at least an implementation of the proxy object to be generated and the implementation of the proxy object having one or more functions to assist the software application in programmatically interacting with the entity, and generate the software application in executable form and the proxy object, based at least in part on the result of said parsing and said gathering, the proxy object settings, the proxy object definition, and the implementation of the proxy object, wherein the compiler generates a first interface function for the proxy object for each added non-built-in function of the implementation of the proxy object, with each first interface function invoking an invoke function to effectuate interaction with the entity for the corresponding added non-built-in function and includes with the generated proxy object one or more interface callback functions to receive reporting of asynchronous events from an asynchronous event router for the entity.

2. The compile-time environment of claim 1, wherein
the proxy object settings of the declarative annotations have one or more configurable properties of the implementation of the proxy object.

3. The compile-time environment of claim 1, wherein the compiler includes with the executable form of the software application, proxy initialization code to instantiate the proxy object, during execution of the software application.

4. The compile-time environment of claim 3, wherein the proxy initialization code is equipped to assign an instance of the proxy object to a variable identified by the proxy object declaration, and register the proxy object to receive notifications of the asynchronous events of the entity.

5. The compile-time environment of claim 3, wherein the compiler includes with the executable form of the software application, the proxy initialization code, in a manner, to ensure the proxy initialization code is executed prior to any programmatic usage of the one or more functions of the implementation of the proxy object by the software application to interact with the entity.

6. The compile-time environment of claim 1, wherein the compiler includes with the generated proxy object one or more second interface functions to receive programmatically invocations of built-in functions of the implementation of the proxy object.

7. The compile-time environment of claim 6, wherein the compiler generates one or more third interface functions for the proxy object for each built-in function of the implementation of the proxy object, with each third interface function invoking the corresponding built-in function to interact with the entity.

8. The compile-time environment of claim 1, wherein the invoke function is equipped to access companion meta data of the proxy object, including meta data describing each added non-built-in function to comprehend the interaction between the software application and the entity, on which the invoke function is to effectuate.

9. The compile-time environment of claim 1, wherein the compiler includes with the generated proxy object, the invoke function to effectuate interaction with the entity for each added non-built-in function of an implementation of the proxy object declaration.

10. The compile-time environment of claim 1, wherein the compiler further generates a companion meta data of the proxy object describing selected aspects of the proxy object.

11. The compile-time environment of claim 1, wherein the compiler further generates a proxy object factory based on the proxy object for enabling n-way interactions between the software application and the entity.

12. The compile-time environment of claim 1, wherein the compiler generates one interface callback function for the proxy object for each built-in callback of an implementation of the proxy object, with each interface callback function invoking the corresponding built-in callback function for the reported asynchronous events to be handled by the corresponding built-in callback.

13. The compile-time environment of claim 1, wherein the compiler generates one interface callback function for the proxy object for each added non-built-in callback of an implementation of the proxy object declaration, with each interface callback function invoking a corresponding event handler of the software application for the reported asynchronous events to be handled by the corresponding event handler of the software application.

14. A runtime environment comprising:
a processor;
a loader operated by the processor and to load a software application in executable form for execution, the software application including proxy initialization codes that are included to generate instantiation of a proxy object, the proxy object abstracting an external entity, and wherein an implementation of the proxy object includes one or more functions the software application programmatically employ to interact with the entity and an invoke function to effectuate interaction with the entity through added one or more non-built-in functions of the implementation of the proxy object; and an asynchronous event router operated by the processor and to report asynchronous events to the software application for the entity, through the proxy object, wherein the asynchronous event router is equipped to listen for the asynchronous events generated by the entity and to report detected asynchronous events by the entity to selected ones of interface callback functions of the proxy object.

15. The runtime environment of claim 14, wherein the proxy object includes one or more interface functions to receive programmatically invocations of the one or more functions of the implementation of the proxy object.

16. The runtime environment of claim 14, wherein the proxy object has a companion meta data describing selected aspects of the proxy object including settings for configurable properties of the implementation of the proxy object.

17. The runtime environment of claim 14, wherein the proxy object has a proxy object factory based on the proxy object to enable n-way interactions between the software application and the entity.

18. The runtime environment of claim 14, wherein the selected ones of interface callback functions comprise an interface callback function for a built-in callback of a default implementation of the proxy object, with the interface callback function invoking a corresponding built-in callback function for the reported asynchronous events to be handled by the corresponding built-in callback.

19. The runtime environment of claim 14, wherein the selected ones of interface callback functions comprise an interface callback function for an added non-built-in callback of the implementation of the proxy object, with the interface callback function invoking a corresponding event handler of the software application for the reported asynchronous events to be handled by the corresponding event handler of the software application.

20. A software compilation method comprising:
parsing, by a compiler, a software application in source form, including discerning and comprehending a proxy object declaration; gathering, by the compiler, (1) one or more declarative annotations from the software application, the declarative annotations including proxy object settings of a proxy object, and (2) a proxy object definition defining the proxy object, the proxy object abstracting an external entity, and the proxy object is to be generated to assist the software application in interacting with the entity, the proxy object definition identifying at least an implementation of a proxy object to be generated and the implementation of the proxy object having one or more functions to assist the software application in programmatically interacting with the entity; and
generating, by the compiler, the software application in executable form and the proxy object, based at least in part on the result of said parsing and said gathering, the proxy object settings, the proxy object definition, and an implementation of the proxy object, wherein said generating comprises generating a first interface function for the proxy object for each added non-built-in function of the implementation of the proxy object, with each first interface function invoking an invoke function to effectuate interaction with the entity for the corresponding added non-built-in function and inclusion with the generated proxy object one or more interface callback functions to receive reporting of asynchronous events generated by the entity from an asynchronous event router for the entity.

21. The software compilation method of claim 20, wherein
the proxy object settings of the declarative annotations have one or more configurable properties of the implementation of the proxy object.

22. The software compilation method of claim 20, wherein said generating comprises inclusion with the executable form of the software application, proxy initialization code to instantiate the proxy object, during execution of the software application.

23. The software compilation method of claim 22, wherein the proxy initialization code is equipped to assign an instance of the proxy object to a variable identified by the proxy object declaration, and register the proxy object to receive notifications of the asynchronous events of the entity.

24. The software compilation method of claim 22, wherein said generating further comprises inclusion with the executable form of the software application, the proxy initialization code, in a manner, to allow the proxy initialization code to be executed prior to any programmatic usage of the one or more functions of the proxy object by the software application to interact with the entity.

25. The software compilation method of claim 20, wherein said generating comprises inclusion with the generated proxy object one or more second interface functions to receive programmatically invocations of built-in functions of the implementation of the proxy object.

26. The software compilation method of claim 25, wherein said generating comprises generating one or more third interface functions for the proxy object for each built-in function of the implementation of the proxy object, with each third interface function invoking the corresponding built-in function to interact with the entity.

27. The software compilation method of claim 20, wherein the invoke function is equipped to access companion meta data of the proxy object, including meta data describing each added non-built-in function, to comprehend the interaction between the software application and the entity, on which the invoke function is to effectuate.

28. The software compilation method of claim 20, wherein said generating comprises generating companion meta data of the proxy object describing selected aspects of the proxy object.

29. The software compilation method of claim 20, wherein said generating comprises generating a proxy object factory based on the proxy object to enable n-way interactions between the software application and the entity.

30. The software compilation method of claim 20, wherein said generating comprises generating one interface callback function for the proxy object for each built-in callback of the implementation of the proxy object, with each interface callback function invoking the corresponding built-in callback function for the reported asynchronous events to be handled by the corresponding built-in callback.

31. The software compilation method of claim 20, wherein said generating comprises generating one interface callback function for the proxy object for each added non-built-in callback of the implementation of the proxy object, with each interface callback function invoking a corresponding event handler of the software application for the reported asynchronous events to be handled by the corresponding event handler of the software application.

32. An execution method comprising:
loading a software application in executable form for execution, including execution of the software application at an included proxy initialization code of the software application in the executable form to instantiate a proxy object, the proxy object abstracting an external entity, and wherein an implementation of the proxy object has one or more functions to assist the software application to programmatically employ to interact with the entity and an invoke function to effectuate interaction with the entity through each added non-built-in function of the implementation of the proxy object; and reporting asynchronous events to the software application for the entity, through the proxy object, wherein an asynchronous event router listens for the asynchronous events generated by the entity and reports detected asynchronous events by the entity to selected ones of interface callback functions of the proxy object.

33. The execution method of claim 32, wherein the method further comprises proxy invocation code of the software application in the executable form invoking one or more interface functions of the proxy object to generate programmatic invocations of the one or more functions of an implementation of the proxy object.

34. The execution method of claim 32, wherein the method further comprises the proxy object accessing companion meta data that describe selected aspects of the proxy object.

35. The execution method of claim 32, wherein the method further comprises generating a proxy object factory based on the proxy object enabling an n-way interaction between the software application and the entity.

36. The execution method of claim 32, wherein the method further comprises an interface callback function of the proxy object for a built-in callback of the implementation of the proxy object, with the interface callback function invoking a corresponding built-in callback function for the reported asynchronous events to be handled by the corresponding built-in callback.

37. The execution method of claim 36, wherein the method further comprises an interface callback function for an added non-built-in callback of the implementation of the proxy object invoking a corresponding event handler of the software application for the reported asynchronous events to be handled by the corresponding event handler of the software application.