Your Ad Here

Thursday, February 26, 2009

Resource comparison

Here is what I am working on.

I need to implement a resource pool that will contain information about physical machines, VMware images, and Network resources (switch, router).

I created an interface called Resource which has a provision method. Provision is unimportant at this time. There is then another class that implements Resource called ResourceImpl. This is an Abstract class that implements a method for comparing attributes, a HashMap of attributes, and of course setters/getters for attributes. There is finally a few concrete class called DracResource and EsxResource that extend ResourceImpl. They currently have no methods other then provision which at this time does nothing. All the Object get instantiated using Spring injection.

Here is my question.

A scheduler is going to request a resource. It will say something like I need a DracResource with the following attributes. It may not be a complete 1-to-1 mapping. It could be that the attributes they are looking for are just a specific CPU chipset(performance testing).

I originally overrode the equals method to make the comparison, but one of my co-workers said that wasn't right because equals is suppose to be well equal and I understand the whole transitive, symmetrical and reflexive part of it, so I said well I can change the name of the method to something like match or compare. This didn't seem to sit will with him either.

He suggested I create another interface that is specifically for comparing Objects, and that the resource manager calls this set of classes to do the comparing. To me it seems like a lot of additional overhead.

Any thoughts to my ramblings?

Thanks,

Read More...
Your Ad Here

No comments: