Skip to Content
Author's profile photo bruce daly

Adding Parent metadata for nested objects (in this case HardwareServer)

I thought I would share something that I have found to be handy in our work here. We are capturing architecture overviews of all of our business systems. These contain (at minimum) a component diagram capturing the high level view of the application architecture, and a technology architecture diagram capturing the servers in the different deployment instances and what is deployed on them (using Traceability Links back to App Architecture components).

We have a model that contains all the information objects that get re-used all over the place. This model is in the Library so everyone gets ready access to it. Hardware Server are one of those objects in this model. In cases where we want to identify the VM’s on a physical server, or have a server named using its hostname within a VM – we have set that up using nested HardwareServer objects.

For a specific System XX Technology model, we take replicas (for a few reasons we did not use shortcuts, but that is another topic) and use them when describing a specific business system. If I end up using a Child HardwareServer in one of these models, it is a pain to figure out the Parent Server and bigger pain if you are consuming a generated report from this model. I would like to see this info at a glance, while I am looking at the HardwareServer.

There may be better ways to deal with it, but for what it is worth, here is what we did …..

1. Create extended attribute – First you need an attribute to store your data in. The intention is to populate that with the name of the Parent object.In an EA model extension, we defined an Extended attribute (“Parent_Server”). In addition because one of our use cases was when looking at a replicated object, we added the following to the Method Script so that we would get more informative behaviour if/when the user ever pressed the edit button beside the metadata item.

Sub %Method%(obj)

   ‘ Implement your method on <obj> here

     Dim modelFileName

   ‘output “in method”

   if obj.Replica then

     ‘output “is replica”

      if Not obj.SourceReplication.OriginalStatus = “Opened” then

            ‘output “not open”

            modelFileName = obj.SourceReplication.OriginalModel.TargetModelFileName

            if Not FileExists(modelFileName) then

               ‘output “file doesn’t exist”

               msgbox “file: ” & modelFileName & ” doesn’t exist!”

               Exit Sub

            end if

            Output “opening replica original model:” & modelFileName

            OpenModel modelFileName, omf_DontOpenView

      end if




   end if

End Sub

2. Script to populate the field – We then needed something to populate the field. As stated earlier, pretty much all the HardwareServers are in one model and then replicates are used in other models. Makes it kind of handy to have them all in the same place. In another extension (or the same one if you want), We created the following for the Model object – this populates the field …

Sub %Method%(obj)

ProcessHardwareServers obj

End Sub

Sub ProcessHardwareServers(obj)

      Dim replica, modelFileName, parent, parentTitle, hws

      for each hws in obj.HardwareServers

         if hws.Replica then

    ‘        if Not hws.SourceReplication.OriginalStatus = “Opened” then

    ‘           modelFileName = hws.SourceReplication.OriginalModel.TargetModelFileName

    ‘           Output “opening replica original model:” & modelFileName

    ‘           OpenModel modelFileName, omf_DontOpenView

    ‘        end if

            output hws.Name + ” is a replica – modify source object in source model instead”

    ‘        set parent = hws.SourceReplication.OriginalObject.Parent


            set parent = hws.Parent

    ‘     end if

           if parent.ClassName = “Hardware Server” then

             output “populating: ” + hws.Name + ” with ” + parent.Name

              parentTitle = parent.Name


              parentTitle = “”

           end if 

           hws.SetExtendedAttributeText “Parent_Server”, parentTitle

           ‘processing nested harware servers

           ProcessHardwareServers hws

        end if



      if obj.ClassName = “Hardware Server” then

         Exit Sub

      end if


      dim pack

      ‘itarate all packages in current model/package

      for each pack in obj.Packages

         ‘recursion to iterate all packages and sub-packages

         ProcessHardwareServers pack


End Sub

Finally, we added an entry to the Tools menu to execute the Method. Rights to edit the Library model are fairly tightly controlled so authors know that when they add a bunch of servers, they should attach the extension and run it. Then later when a user is using a replicate in one of their models they have a Parent_Server metadata item embedded with their HardwareServer object.

As I said at the start, maybe there is a better way, but we did not find an approach that did all we wanted. For what it is worth, perhaps this will be of use to someone.



Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo George McGeachie
      George McGeachie

      Nice article, Bruce. I've done something similar to add the name of the ultimate supertype(s) of an entity to the entity properties.