InRule’s Authoring SDK provides a broad and deep framework for authoring rules in stateful applications. irAuthor, InRule’s rule authoring application, is written almost entirely with the Authoring SDK.
While useful as-is, the Authoring SDK’s behavior can be modified via extensibility. Third party developers can extend InRule’s authoring capabilities via one of two means:
- Custom applications, where the InRule Authoring SDK is used from within a customer’s application. This allows customers to use the power of InRule’s authoring framework in their existing applications or alongside fresh code in new applications.
- irAuthor, where a customer’s code (in .NET assemblies) is loaded into InRule’s authoring tool and is able to influence how it works by adding, modifying and/or removing features and functionality.
While there are a number of extensibility points in the Authoring SDK, two are prevalent:
The Authoring SDK provides a number of ways to manipulate application and rule application state. It also provides dozens of events that indicate when that state has changed. This allows developers to not only modify state themselves, but to react when others do. Events are thrown when rule applications are opened or closed, items are added or removed from them, the selected item has changed, etc. For example, a company can enforce naming standards for items in a rule application by subscribing to the event that fires when items are renamed.
Managers take requests for certain types of objects and hand off those requests to one or more providers, which actually provide the requested objects. The Authoring SDK comes with a default provider for each manager, and customers may add additional providers – or even replace the default ones.
The Authoring SDK contains an ImageService class and IImageProvider interface, both of which contain a single method: GetImage(object o, ImageSize size). The Authoring SDK contains a default implementation of IImageProvider, named DefaultImageProvider. When ImageService.GetImage is called, it searches for the image provider that’s registered to handle that type of object. It then calls GetImage on the provider and returns the result. For example, if ImageService.GetImage is passed an EntityDef object, an Entity image is returned.
If a customer would rather have entities depicted as pizzas they could write a custom image provider and register it with the image service, letting the service know that it would provide images for all Entities. Now, when the image service is asked for an image representing an entity, it would see that the custom image provider is handling Entity images, call GetImage on that one, and the pizza image would be returned.
This works with any code that utilizes the manager – including custom applications and irAuthor. Since irAuthor is written with the Authoring SDK, all images of entities would be replaced with pizzas.
Services provide the bulk of the functionality within the Authoring SDK. The following list is a sampling of services that are included:
- Service Manager
- The Service Manager contains all of the other services, providing easy access to them from a single location.
- Selection Service
- Like Microsoft Outlook or Windows File Explorer, authoring is generally tree-driven and has the concept of a “selected” item. The selection service does two things: Allows code to “select” an item and allows developer to know when something has been selected (via events).
- Rule Application Service
- The Rule Application Service allows developers to perform operations on the rule application as well as respond to actions others are performing on it. For example, rule applications may be loaded (via file or catalog), saved, checked in/out, etc. It also has a reference to the Rule Application Controller, which allows developers to manipulate the rule application (add/edit/remove items, etc). Most operations have related events, allowing developers to respond to the actions performed on the rule application.
- Command Service and Command Providers
- Commands are discreet bits of functionality. For example, the Paste Command executes a paste from the clipboard. Command Providers determine which commands can be executed on a given item. The authoring framework includes a command provider that provides default functionality. InRule customers may write their own command providers that add additional commands or remove commands in the default provider. The Command Service works with one or more command providers to determine which commands are available for given items.
- Content Manager and Content Providers
- Similar to Command Providers, Content Providers provide user interfaces for items and InRule ships with a default content provider for all of the different items in a rule application. The Content Manager works with one or more Content Providers to determine with user interface should be shown for each type of item.
- Image Service and Image Providers
- The image service returns images for given items. This allows InRule customers to use the same images as irAuthor without writing any custom code and, conversely, allows irAuthor to use custom images provided by a customer.
- Options Service
- The Options Service allows developer to add their own options controls to the Options screen.
- Settings Storage Service
- The Settings Storage Service provides a means to easily save and load settings.
Developers can extend irAuthor via the Authoring SDK and “extensions”. Extensions are simply a means for loading developer code into irAuthor. Once loaded into irAuthor, extensions have full access to the Authoring SDK, including the irAuthor Shell.
The irAuthor Shell is an abstraction of the irAuthor user interface. It provides access to the following items, and more:
- The ribbon
- Tabs, groups, all types of buttons, etc. may be added to and removed from the ribbon.
- The File/application menu
- Groups and buttons may be added and removed from the menu.
- Quick Access Toolbar
- Buttons may be added and removed from the QAT.
- Tool windows
- Tool windows containing custom controls may be added to the irAuthor window.
- The status bar
- Items may be added to the status bar to indicate a particular state.
- Navigation control
- irAuthor ships with a Microsoft Outlook-like navigation control, but it may be replaced by a custom control. (It, too, can be manipulated if desired.)
- Input bindings
- Hot-keys may be created and assigned via the input bindings.
- Interactive Errors tool window
- Developers can display errors and perform custom actions when the user clicks on them.
The next post in this series will provide a number of examples of extensibility.