Bill Gibson, Program Manager
The Application Designer and Logical Datacenter Designer support a Toolbox containing items that allow you to create new content on the diagrams. These items include applications, logical servers, zones, and endpoints. It is easy but misleading to think of these as simply representing the types that can be added to the diagrams. In fact, these toolbox items (or prototypes) are more sophisticated. In addition, the tools allow you to create and add your own custom prototypes to the toolbox. This note explores what toolbox prototypes are, and how you can create and use custom prototypes.
How Toolbox Prototypes Work
The Application Designer and Logical Datacenter Designer ship with a default set of prototypes pre-installed in each toolbox. When one of these is dropped onto the diagram, it causes objects to be created on the diagram. Toolbox prototypes contain a graph of model objects that are pasted into the model when you drop the item onto the diagram. In many ways, it is simpler to think of them as cached clipboard entries. Prototypes must be used in the proper context. For example, you cannot drop an application onto another application. When prototypes are dropped, various “fix-up” and validation rules are applied to ensure that the objects being added are compatible with the target context and don’t conflict with existing objects in that context. For example, if you drop an endpoint on an application, the application must first support that kind of endpoint and then the name of the endpoint being added may need to be changed if the name has already been used for an endpoint or resource of that application.
The use of this mechanism treating the toolbox as a cached set of clipboard entriesis simple, elegant, and yet very powerful. Almost any set of model objects that you can copy/paste on the diagram can be added to the toolbox for use later.
One of the most compelling scenarios for the use of prototypes is the ability to save initial configurations of applications or servers so that they can be reused as a starting point in a design.
Prototypes can Create Variations of the Same Type
You can create instances of the same type on each diagram using a number of items in the toolbox. The value of this can be seen in the initial Toolbox configuration for the Application Designer. Two prototypes in the toolbox create variations of an ASP.NET Web Application. The first, labeled ASP.NET Web Application, creates an ASP.NET Web Application with a default Web content endpoint and uses the ASP.NET Web site template. The other prototype, labeled ASP.NET Web Service, also creates an ASP.NET Web Application but with a default Web service endpoint and uses the Empty Web Site template. Both specify Visual Basic as the default language.
Figure 1 Two ASP.NET prototypes create different configurations of an ASP.NET application
Regardless of which of these two prototypes you use, the same underlying type of application is created. The prototype you use predefines some of the initial characteristics and content of the application. Once the application has been added to the diagram, you are free to change any of these characteristics.
Creating Custom Prototypes
You can use any application, server, or endpoint as the basis of a custom prototype that you save to the toolbox. For example, you might create a custom prototype for the following reasons:
Once you’ve created your custom prototype, you can choose to delete the default prototypes and use only your own. As prototypes are saved in files, these can be shared with others in your team or across your organization.
To create a custom prototype, select the item(s) that you want to add to the Toolbox and select Add to Toolbox. You will be prompted to provide a toolbox name for the prototype, a file name, and a bitmap.
If you select multiple items, a single toolbox prototype is still created. This is one of the most powerful aspects of creating custom prototypes, allowing you to predefine useful patterns of applications, servers, or groups of endpoints which can then be added to the diagram with a single gesture. If you select multiple items you must ensure that they are from the same context. For example, multiple endpoints must be from the same application, logical server, or zone; servers and zones must be from the same parent zone; and endpoints cannot be mixed with anything else. If the selected applications, servers or zones are connected, the pasted objects will also be connected. If an application in the selection is connected via consumer endpoints to an unselected application, the consumer endpoint will be included in the prototype and configured. In addition, it will be connected to the associated provider, if it is present on the diagram when the prototype is used.
Figure 2 A single toolbox prototype can abstract a complex pattern of applications
Using this feature, you might create patterns such as a database-backed service containing a linked ASP.NET Web Application with a Web service endpoint connected to a database, or perhaps a three-tier client-service-database pattern. In the Logical Datacenter Designer, you might create a standard zone with configured and connected logical servers. The possibilities are literally endless!
The Distributed System Designers provide a powerful mechanism that allows custom toolbox items (prototypes) to be created from objects in your diagrams and shared with other users. Prototypes can contain single applications, servers, and endpoints, or they can represent complex patterns of connected objects.