How can you properly model nested / helper classes in UML?

I played with UML

My main background is a system administrator, not a programmer.

To better understand class models, I tried to map the xmdomain.cfg file of the xen hypervisor to UML (you can find the help page at http://linux.die.net/man/5/xmdomain.cfg )

So, after it works, I get a basic start like this (note that these are only attributes, not actions)

xenDomU:[
    - kernelImage
    - initialRamdisk
    - allocatedMemory
    - rootDevice
    - nicAmount
    - domuName
]

The next situation was a real pain in the ass

"disk" and "vif" can occur several times in the domu configuration file. ("disk" can occur from 1 to infinite times and "vif" from 0 to infinite times) essentially they themselves are classes

disk:[
    - backendDevice
    - frontendDevice
    - deviceAccessMode
]

virtualNetworkInterface:[
    - networkBridgeDevice
    - interfaceIP
    - macAddress
    - interfaceName
]

, " " - 3 , , , .

shutdownOptions{
    - onShutdown
    - onReboot
    - onCrash
}

, -, UML .

xenDomU:[
    kernelImage
    initialRamdisk
    allocatedMemory
    rootDevice
    nicAmount
    disk:[
        backendDevice
        frontendDevice
        deviceAccessMode
    ]
    domuName
    virtualNetworkInterface:[
        networkBridgeDevice
        interfaceIP
        macAddress
        interfaceName
    ]
    shutdownOptions{
        onShutdown
        onReboot
        onCrash
    }
]

, "" , , .

-, , .

+3
2

shutdownOptions , . , .

(UML 2.3, 9.3.1), , Disk VIF , VIF. , , .

alt text

TextUML ( ):

package xen;

class XenDomU
    attribute domuName : String;
    attribute kernelImage : any;
    attribute initialRamdisk : any;
    attribute allocatedMemory : any;
    attribute rootDevice : any;
    attribute nicAmount : any;
    attribute shutdownMode : ShutdownOptions;
    composition disks : Disk[*];
    composition interfaces : VirtualNetworkInterface[*];
end;

class Disk
    attribute backendDevice : any;
    attribute frontendDevice : any;
    attribute deviceAccessMode : any;
end;

class VirtualNetworkInterface
    attribute networkBridgeDevice : any;
    attribute interfaceIP : any;
    attribute macAddress : any;
    attribute interfaceName : any;
end;

enumeration ShutdownOptions
         onShutdown,
         onReboot,
         onCrash
end;

end.
+1

, VIF . , UML . , , .

+2

Source: https://habr.com/ru/post/1710364/


All Articles