Many software applications can be extended with custom functionality. Custom functionality is often provided through an extension. An “extension”, often called an add-in or plugin, is a component that is loaded into a host application. A “host application” is an application being extended by an extension. As one or more extensions are loaded into a host application, the host application then encompasses any code that is active within the host application at that time. Extensions are typically discovered dynamically and then loaded by the host application. An extension is designed to expand the functionality of the host application beyond what the host application provides standing alone. For example, an extension might be used from within a word processing program to search the Internet for articles relating to a certain word that was typed within the word processing program. In this example, the host application is the word processing program, and the Internet search tool is the extension.
Extensions are typically created as a dynamic link library (DLL), shared object, archives bundle or other program that the host application can load. Some extensions do not work well with other extensions, or only work with certain other extensions. In current scenarios, the host application typically loads all activated extensions and then later handles the errors or incompatibilities that may occur due to these conflicts when the host application knows how to handle the conflicts. When the host application does not know how to handle the conflicts, the host application can crash or otherwise suffer in some fashion.
Various technologies and techniques are disclosed for creating and managing extensions. An extension manager is operable to interact with and manage extensions in at least two categories. A first set of extensions belongs to a first category of extensions, such as operative extensions. A second set of the extensions belongs to a second category of extensions, such as cooperative extensions. The second set of extensions contains one or more declarations of compatibility with one or more extensions in the first set of extensions. The extension manager is operable to load zero or more of the first set of extensions into a host application. The extension manager is also operable to load zero or more of the second set of extensions into the host application based upon an analysis of the one or more declarations of compatibility. In other words, the declarations of compatibility determine which extensions in the second set of extensions actually get loaded.
In one implementation, an extension manager framework is described. The framework has a language syntax for describing the operation of a plurality of extensions. The language syntax is operable to enable a cooperative extension to declare compatibility with one or more operative extensions, so that the cooperative extension is only loaded into a host application in situations where the cooperative extension has been pre-defined as being compatible.
In another implementation, a process for loading extensions using declarations of compatibility is described. An extension loading process is initiated for a host application. Zero or more operative extensions are loaded into the host application. At least one declaration of compatibility assigned to at least one cooperative extension is analyzed. When the analyzing step reveals that at least one cooperative extension is compatible with the zero or more operative extensions that are being loaded, then the at least one cooperative extension is loaded into the host application.
This Summary was provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
The technologies and techniques herein may be described in the general context as techniques for creating and managing extensions, but the technologies and techniques also serve other purposes in addition to these. In one implementation, one or more of the techniques described herein can be implemented as features within a software development program such as MICROSOFT® VISUAL STUDIO®, a framework environment such as MICROSOFT®.NET Framework, or from any other type of program or service that allows for creation and/or management of extensions.
As described in further detail herein, an extension manager system provides technologies and techniques that enable extensions (such as extensions in one category of extensions) to declare their compatibility and/or incompatibility with other extensions (such as extensions in another category of extensions). For example, cooperative extensions can declare their compatibility with operative extensions, as described in further detail in
In one implementation, a framework is provided that has a language syntax that allows a developer or other end user to specify various details about the extension, including the declarations of compatibility. For example, the language syntax allows proxy behaviors to be specified for extensions, such as to indicate what should happen when errors occur. This framework facilitates the development of extensions in ways that can have provider agnostic portions and provider specific portions of the application. This framework is described in further detail in
As shown in
A declaration of compatibility can declare a specific compatibility or incompatibility with an operative extension or a grouping of operative extensions in one of various ways. As one non-limiting example, object oriented type inheritance can be used to indicate that a given cooperative extension should be loaded (or not loaded) when an operative extension that derives from a particular base class is loaded. As another non-limiting example, a strict type matching technique could be used in an object oriented fashion so that a given cooperative extension is only loaded if a very specific operative extension is loaded. Yet another non-limiting example for specifying declarations of compatibility includes a tag-matching scheme where the cooperative extension is tagged with a unique name or other identifier of the operative extension to which compatibility or incompatibility is being declared. Any other technique that would allow a given cooperative extension to indicate its compatibility and/or incompatibility with operative extension(s) can also be used.
A declaration of compatibility can be contained in various locations, such as compiled as part of an executable version of the extension (such as in the DLL or EXE file) or contained in an extension file. Declarations of compatibility could also be stored in other locations, such a database, or in any other format for storing information as would occur to one in the computer software art. More details regarding a declaration of compatibility and a corresponding code example are provided in the discussion of
Extension manager 108 is responsible for initiating an extension loading process 110 to load the operative extension(s) 102 and the appropriate cooperative extension(s) 104 into the host application 112. The extension manager 108 accesses the declaration(s) of compatibility 106 to determine which cooperative extension(s) 104 can be loaded with the operative extension(s) 102 that are also being loaded. In one implementation, the declarations of compatibility are accessed at the time extensions are being loaded into a host application in order to determine which cooperative extensions to load. In another implementation, extension compatibilities can be statically established at install time, and then retrieved during an extension loading process to determine which cooperative extensions to load. The load process is described in further detail in
In one implementation, each instance of extension manager 108 maintains an extension context that reflects certain extension loading criteria. A host application may choose to instantiate any number of extension manager instances to support its extension loading context needs. For example, perhaps an application that manages a project system might use a single instance of the extension manager 108 for each currently loaded project or project type, depending on the granularity of context needed. Meanwhile, a simpler application may just use a single instance of the extension manager 108 for the life of the application.
In one implementation, cooperative extension(s) 104 can request information from the extension manager 108 about currently loaded extensions. The host application can receive a list of implementing extensions from the extension manager 108, and this list can reflect various filtering including, extension compatibility, base type inheritance, SKU restrictions, default instance specification, etc. Some of this information that can be provided to the cooperative extension(s) 104 and otherwise used for other operations of extension manager system 100 will be described in further detail in
A single cooperative extension may declare its compatibility with multiple operative extensions. Here is an example of what an extension compatibility declaration can look like in code:
In one implementation, this approach to extensibility (by declaring compatibility) enables the development of generic extensions and specific extensions, all living together in the same extension ecosystem. Extensions do not need to use dynamic discovery or later analysis to determine if they are compatible with the current host application. In such a scenario, extensions can be assured that if they are activated at all, then they are working in an application with compatible specifics.
Continuing on with the next declaration on
Language syntax 172 of extension manager framework 170 also allows extensions to have a declaration of proxy behavior 178. A proxy can provide a substitute behavior that should be used to wrap each instance of a particular extension in a “pass through manner” such that if a call in the extension fails, the proxy gets a first opportunity to translate the failure into some other result. Similarly, the proxy has the choice not to pass a call through to the inner extension instance. In other words, when a proxy is specified, the proxy is called instead of the extension directly, and then the proxy calls the extension. However, if the proxy intercepts an error, such as when a faulty instance of the extension is encountered, then the proxy may choose to handle the error in some way and bypass calling the extension. The use of proxy behaviors is described in further detail in
Another declaration that language syntax 172 can support is a declaration of instancing rules 180 specifying when a single or more than one extension of a particular type should be loaded, as well default behaviors that define which extension type to choose when there are more than one. For example, when an instance of a specific extension cannot be loaded, a default behavior that was declared for the specific extension can be retrieved, and that default behavior executed for the specific extension.
A singleton behavior declaration 182 can also be used to specify that there should only be one singleton extension per a certain extension type per extension context or instance of an extension manager. The singleton behavior declaration 182 specifies what should be done if more than one extension satisfies the criteria. In one implementation, an extension can declare that it is the “default” singleton, which means that the extension should only be used if no other extension matches the criteria. When there are multiple matches to the criteria, then the extension compatibilities of matching extensions are compared, and the most precise match wins (e.g. that extension will be used over the others).
Other declarations and/or features can also be provided by language syntax 172 of extension manager framework 170 that are not specifically discussed here. For example, a description declaration could be provided to allow descriptions to be provided for an extension. A feature could be provided in language syntax 172 or elsewhere to enable references to be made back to extension manager, such as when a cooperative extension needs to gather other extension information from extension manager. Furthermore, in some implementations, some, additional, and/or other features may be provided in language syntax 172 than those shown in
Turning now to
If, however, the cooperative extension is not declared to be compatible with the operative extensions (decision point 208), then the cooperative extension is not loaded into the host application due to the incompatibility (stage 212). In one implementation, the cooperative extension can be determined to be incompatible because none of the operative extensions loaded are in a list of compatible extensions. In another implementation, the cooperative extension can be determined to be incompatible because a specific operative extension that is loaded is listed as having a specific incompatibility. Other ways for specifying and/or determining compatibility or incompatibility between cooperative extensions and operative extensions can also be used.
Turning now to
In this example, Sql2000DatabaseSchemaProvider 406, Sql2005DatabaseSchemaProvider 408 and AnotherSqlDatabaseSchemaProvider 410 represent concrete implementations of extensions which are identified by the base extension type, DatabaseSchemaProvider 402. Additionally, SqlDatabaseSchemaProvider 404 is an abstract base class of the two SQL Server implementations in this example. SqlDatabaseSchemaProvider 404 can be used both for shared functionality as well as for an identification of the two derived implementations, for extensions that wish to declare their compatibility with both.
Continuing the example from
As shown in
Additionally, device 500 may also have additional features/functionality. For example, device 500 may also include additional storage (removable and/or non-removable) including, but not limited to, magnetic or optical disks or tape. Such additional storage is illustrated in
Computing device 500 includes one or more communication connections 514 that allow computing device 500 to communicate with other computers/applications 515. Device 500 may also have input device(s) 512 such as keyboard, mouse, pen, voice input device, touch input device, etc. Output device(s) 511 such as a display, speakers, printer, etc. may also be included. These devices are well known in the art and need not be discussed at length here. In one implementation, computing device 500 includes extension manager system 100.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. All equivalents, changes, and modifications that come within the spirit of the implementations as described herein and/or by the following claims are desired to be protected.
For example, a person of ordinary skill in the computer software art will recognize that the examples discussed herein could be organized differently on one or more computers to include fewer or additional options or features than as portrayed in the examples.