views:

84

answers:

1

I've been playing around with UML

My primary background is that of a sysadmin, not as a programmer.

In order to get a better understanding of class models I've been trying to do map out the xmdomain.cfg file the xen hypervisor in UML (you can find the man page at http://linux.die.net/man/5/xmdomain.cfg)

So after working it out i get a basic start like this (note, this is attributes only, not actions)

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

The following situation has been a real pain in the ass

"disk" and "vif" can both occur multiple times in a domu config file. ("disk" can occur 1 to infinite times and "vif" 0 to infinite times) essentially they are classes themselves

disk:[
    - backendDevice
    - frontendDevice
    - deviceAccessMode
]

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

In addition, "domain shutdown options" are really 3 values but it's actually best summorized as a single attribute, but then you get the same situation as above.

shutdownOptions{
    - onShutdown
    - onReboot
    - onCrash
}

So after that, you end up with something that really doesn't seem like valid UML to me.

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

I'm sure there are "better" ways to do this, but this is what seems like the most natural to me.

Could someone please enlighten me and show the right way to do this.

+1  A: 

I didn't understand why couldn't you have Disk and VIF as regular classes and create associations. As far as I know, UML doesn't support nested classes. However in some cases you can associate package with classes you wanted to be nested with the class you want to nest into.

Gabriel Ščerbák