Share via


How to: Create an SDM Logical Server System

How to: Create an SDM Logical Server System

Using SDM, you can create a logical server system model that models a real logical server by hosting other SDM objects and containing a variety of settings. This system model is able to host SDM objects such as application systems, endpoints that let this system communicate with other systems, and resources. You can create settings on the logical server system that model the behavior of a real logical server, such as the minimum version of an application or an OS that the logical server will host.

This section describes the steps to create a system that models a logical server.

Bb167811.wedge(en-us,VS.90).gifTo create an SDM system that models a logical server

  1. Create a .sdm document named Microsoft.Samples.MyLogicalServer.sdm.

    For more information on creating a .sdm document, see How to: Create an SDM Document. Use the code below to start your .sdm document.

    <?xml version="1.0" encoding="US-ASCII"?>
    

<SystemDefinitionModel Name="Microsoft.Samples.MyLogicalServer" Version="1.0.0.0" xmlns="https://schemas.microsoft.com/SystemDefinitionModel/2005/1" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xs="https://www.w3.org/2001/XMLSchema">

&lt;Information&gt;
    &lt;FriendlyName&gt;Example of a system in the host layer.
    &lt;/FriendlyName&gt;
    &lt;CompanyName&gt;Microsoft Corporation&lt;/CompanyName&gt;
    &lt;Copyright&gt;Copyright (c) Microsoft Corporation.  
        All rights reserved.  
        This is provided AS IS with no warranties, 
        and confers no rights.&lt;/Copyright&gt;
&lt;/Information&gt;

&lt;!-- Add import information here --&gt;

&lt;!-- Add system information here --&gt;

&lt;!-- Add containment relationship for resource --&gt;

&lt;!-- Add containment relationship for endpoints --&gt;

&lt;!-- Add containment relationship for Host layer and Host zone --&gt;

</SystemDefinitionModel>

For more information on the XML elements used in the code above, see [**SystemDefinitionModel Element**](bb168334\(v=vs.90\).md) and [**Information Element**](bb168173\(v=vs.90\).md).
  1. Add <Import> elements for each imported .sdmdocument file.

    Whenever a .sdm file needs to reference a definition found in a .sdmdocument file, an <Import> element is used. When an <Import> element is used in the .sdm file, the compiler command sdmc.exe /r must be used to compile the document. Each <Import> element specifies:

    • A reference to a definition in a .sdmdocument file.
    • An Alias attribute whose value specifies the prefix that will be used when referring to other documents from the current file.
    • The Name attribute of the SystemDefinitionModel element that is being referenced.

    Add the following XML block to the Microsoft.Samples.MyLogicalServer.sdm file to specify the imports that will be used in this sample.

    <!-- Import information -->
    <Import Alias="DC" Name="Microsoft.Datacenter"/>
    <Import Alias="Ftp" Name="Microsoft.Samples.SimpleFtp"/>
    <Import Alias="Certs" Name="Microsoft.Samples.Certificates"/>
    
For more information on the XML elements used in the code above, see [**Import Element**](bb168171\(v=vs.90\).md).
  1. Create an ApplicationHost layer system.

    1. This system is in the ApplicationHost layer because it models a logical server that can host application systems from the Application layer. This will allow you to create a new system in the Logical Design Diagram (LDD). The system is named MyLogicalServer. Add the following code to the Microsoft.Samples.MyLogicalServer.sdm file.

      <!-- System information -->
      

<SystemDefinition Name="MyLogicalServer" Layer="ApplicationHost" Abstract="true"/>

    For more information on the XML elements used in the code above, see [**SystemDefinition Element**](bb168339\(v=vs.90\).md).

2.  Add deployment report data to the \<SystemDefinition\> element that was created in step 3a.
    
    Every system definition that is loaded by the design surface in Visual Studio 2005 needs a \<DesignData\> element for the deployment report. When the deployment report is generated, it will use the design data to indicate what type of system definition is used. If the appropriate design data is not added to a system definition, you will get an error when you generate the deployment report.
    
    Under the \<DesignData\> element in your system definition, add the Report element with Type="LogicalServer". Replace the \<SystemDefinition\> element created in the step above with the \<SystemDefinition\> element below.
    
    <pre IsFakePre="true" xmlns="https://www.w3.org/1999/xhtml">&lt;!-- System information --&gt;

<SystemDefinition Name="MyLogicalServer" Layer="ApplicationHost" Abstract="true"> <DesignData> <Report Type="LogicalServer" xmlns="https://schemas.microsoft.com/SystemDefinitionModel/2005/1/DesignData/DeploymentReport" /> </DesignData> </SystemDefinition>

    For more information on the XML elements used in the code above, see [**DesignData Element**](bb168144\(v=vs.90\).md).

3.  Add settings to the \<SystemDefinition\> element that was created in step 3b.
    
    Add a few settings to the logical server system so that in Visual Studio the user will be able to specify the version of an application system that the logical server system can support. The restriction on the application version is modeled by using a constraint. The code for the constraint is in the application system's .sdm file, not in this logical server system's .sdm file.
    
    Replace the \<SystemDefinition\> element created in step 3b with the \<SystemDefinition\> element below.
    
    <pre IsFakePre="true" xmlns="https://www.w3.org/1999/xhtml">&lt;!-- System information --&gt;

<SystemDefinition Name="MyLogicalServer" Layer="ApplicationHost" Abstract="true"> <DesignData> <Report Type="LogicalServer" xmlns="https://schemas.microsoft.com/SystemDefinitionModel/2005/1/DesignData/DeploymentReport" /> </DesignData>

    &lt;!-- Create some settings for the version of MyApplication
        that can be hosted on MyLogicalServer. --&gt;
    &lt;SettingDeclaration Name="MinAppVersion" 
        Definition="Version" List="false" CanBeNull="false"/&gt;
    &lt;SettingDeclaration Name="MaxAppVersion" 
        Definition="Version" List="false" CanBeNull="false"/&gt;
    &lt;SettingDeclaration Name="MinAppVersionInclusive" 
        Definition="Boolean" List="false" CanBeNull="false"/&gt;
    &lt;SettingDeclaration Name="MaxAppVersionInclusive" 
        Definition="Boolean" List="false" CanBeNull="false"/&gt;

</SystemDefinition>

    For more information on the XML elements used in the code above, see [**SettingDeclaration Element**](bb168223\(v=vs.90\).md).
  1. Add containment relationships to your system so that the system can contain endpoints and resources.

    By adding resources and endpoints, you allow the system to communicate and define relationships with existing systems.

    1. Adding a resource to a system allows the system model to contain a software or hardware element. Examples of resources in an operating system include certificates, certificate stores, files, directories, and registry keys. In this example, the resource that this system will contain is a certificate store named CertificateStore. To create this resource, see How to: Create an SDM Resource.

      The following code defines the containment definition of the certificate store resource so the system can contain the resource. Add the following code to your .sdm document.

      <!-- MyLogicalServer can contain a certificate store -->
      

<ContainmentDefinition Name="MyLogicalServerContainsCertificateStore" ParentDefinition="MyLogicalServer" MemberDefinition="Certs:CertificateStore"/>

    For more information on the XML elements used in the code above, see [**ContainmentDefinition Element**](bb168053\(v=vs.90\).md).

2.  Adding endpoints to a system allows the system to be able to communicate with other systems over a protocol such as HTTP, TCP/IP, or FTP. In this example, the endpoints that this system will contain are named FtpClient and FtpServer. These endpoints allow the logical server system to communicate with other systems using FTP. To create these endpoints, see [How to: Create an SDM Endpoint](bb167809\(v=vs.90\).md).
    
    The following code defines the containment definitions of the FTP endpoints so the system can contain the endpoints. Add the following code to your .sdm document.
    
    <pre IsFakePre="true" xmlns="https://www.w3.org/1999/xhtml">&lt;!-- MyLogicalServer can contain ftp endpoints
in the host layer --&gt; 

<ContainmentDefinition Name="MyLogicalServerContainsFtpContentClient" ParentDefinition="MyLogicalServer" MemberDefinition="Ftp:FtpClient"/> <ContainmentDefinition Name="MyLogicalServerContainsFtpContentServer" ParentDefinition="MyLogicalServer" MemberDefinition="Ftp:FtpServer"/>

3.  Add required Logical Design Diagram (LDD) containments.
    
    In order to create a functional system in the ApplicationHost layer, required containment definitions must be added. Otherwise, you will not be able to create a connection from application systems in the Application layer to the logical server system in the ApplicationHost layer.
    
    1.  In order for a system to participate in a zone, define a containment from the HostZone to MyLogicalServer. Add the following code to your .sdm document.
        <pre IsFakePre="true" xmlns="https://www.w3.org/1999/xhtml">&lt;!-- A system in the Host layer
must be contained by HostLayer and HostZone --&gt;

<ContainmentDefinition Name="HostZoneContainsMyLogicalServer" ParentDefinition="DC:HostZone" MemberDefinition="MyLogicalServer"/>

    2.  To allow an application to be mapped to this logical server, define a containment from the HostLayer to MyLogicalServer. Add the following code to your .sdm document.
        <pre IsFakePre="true" xmlns="https://www.w3.org/1999/xhtml">&lt;ContainmentDefinition 
Name="HostLayerContainsMyLogicalServer"
ParentDefinition="DC:HostLayer"
MemberDefinition="MyLogicalServer"/&gt;
  1. Compile the .sdm File

    Use the SDM compiler to validate the .sdm file that you created in the steps above. For more information on the SDM compiler, see SDM Command Line Compiler (SdmC.exe). To invoke the sdm compiler, open an SDM SDK compiler window and type the following command at the command prompt.

    Sdmc.exe Microsoft.Samples.MyLogicalServer.sdm /r Microsoft.Datacenter.sdmdocument /r Microsoft.Samples.SimpleFtp.sdmdocument /r Microsoft.Samples.Certificates.sdmdocument /SearchPath "%SdmModelsDir%\"

    If the .sdm document is valid XML, the command above will produce the compiled form of the document, namely, Microsoft.Sample.MyLogicalServer.sdmdocument. Note that the format of the compiled file is slightly different from the format of the .sdm file.

  2. Create a prototype for the system.

    In order for the system to appear in the toolbox in Visual Studio, you need to create a prototype for the system. Run the ProtoGen.exe tool with the following command line, which will create a prototype file named MyLogicalServer.lddPrototype. For more information on the ProtoGen.exe tool, see SDM Prototype Generator (ProtoGen.exe).

    ProtoGen.exe /Type System /Layer Host /Document Microsoft.Samples.MyLogicalServer /TypeName MyLogicalServer /Output MyLogicalServer.lddPrototype

    For information on installing the prototype and the .sdmdocument file so that the logical server system can be used in Visual Studio, see step 2 in How to: Create an SDM System.

Example

The following code is a complete example of a logical server system named MyLogicalServer.

<?xml version="1.0" encoding="US-ASCII"?>
<SystemDefinitionModel Name="Microsoft.Samples.MyLogicalServer"
    Version="1.0.0.0" 
    xmlns="https://schemas.microsoft.com/SystemDefinitionModel/2005/1"
    xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="https://www.w3.org/2001/XMLSchema">
   
    <Information>
        <FriendlyName>Example of a system in the host layer.
        </FriendlyName>
        <CompanyName>Microsoft Corporation</CompanyName>
        <Copyright>Copyright (c) Microsoft Corporation.  
            All rights reserved.  
            This is provided AS IS with no warranties, 
            and confers no rights.</Copyright>
    </Information>

    <Import Alias="DC" Name="Microsoft.Datacenter"/>
    <Import Alias="Ftp" Name="Microsoft.Samples.SimpleFtp"/>
    <Import Alias="Certs" Name="Microsoft.Samples.Certificates"/>

    <SystemDefinition 
    Name="MyLogicalServer" 
    Layer="ApplicationHost" 
    Abstract="true">
        <DesignData>
            <Report Type="LogicalServer" 
                xmlns="https://schemas.microsoft.com/SystemDefinitionModel/2005/1/DesignData/DeploymentReport" />
        </DesignData>

        <!-- Create some settings for the version of MyApplication
            that can be hosted on MyLogicalServer. -->
        <SettingDeclaration Name="MinAppVersion" 
            Definition="Version" List="false" CanBeNull="false"/>
        <SettingDeclaration Name="MaxAppVersion" 
            Definition="Version" List="false" CanBeNull="false"/>
        <SettingDeclaration Name="MinAppVersionInclusive" 
            Definition="Boolean" List="false" CanBeNull="false"/>
        <SettingDeclaration Name="MaxAppVersionInclusive" 
            Definition="Boolean" List="false" CanBeNull="false"/>
    </SystemDefinition>

    <!-- MyLogicalServer can contain a certificate store -->
    <ContainmentDefinition 
        Name="MyLogicalServerContainsCertificateStore" 
        ParentDefinition="MyLogicalServer"
        MemberDefinition="Certs:CertificateStore"/>

    <!-- MyLogicalServer can contain ftp endpoints
        in the host layer --> 
    <ContainmentDefinition 
        Name="MyLogicalServerContainsFtpContentClient"
        ParentDefinition="MyLogicalServer"
        MemberDefinition="Ftp:FtpClient"/>
    <ContainmentDefinition 
        Name="MyLogicalServerContainsFtpContentServer"
        ParentDefinition="MyLogicalServer"
        MemberDefinition="Ftp:FtpServer"/>

    <!-- A system in the Host layer
        must be contained by HostLayer and HostZone -->
    <ContainmentDefinition 
        Name="HostZoneContainsMyLogicalServer"
        ParentDefinition="DC:HostZone"
        MemberDefinition="MyLogicalServer"/>
    <ContainmentDefinition 
        Name="HostLayerContainsMyLogicalServer"
        ParentDefinition="DC:HostLayer"
        MemberDefinition="MyLogicalServer"/>

</SystemDefinitionModel>

See Also

How to: Create an SDM System
How to: Create an SDM Application System

Send comments about this topic to Microsoft

Build date: 10/2/2007