On 01/28/10 11:55, John Mazzitelli wrote:
For the record, I'm fine with SystemInfo returning a set of
values.
I may be misunderstanding the design of this template engine thing, but,
I'm assuming you just want SystemInfo to return you a basic map of
information.
I think this should be on the SystemInfo interface, and not
SystemInfoFactory. The factory is really just that - a factory that
creates SystemInfo implementations.
Remember, some agents for one reason or another will NOT have SIGAR
available (either a user purposefully disabled the native layer because
it crashes on their particular platform due to a bug OR SIGAR is not
supported on their platform). So you must insure you support (even if
its limited support) that use case.
Therefore, I think there needs to be something on the SystemInfo
interface as opposed to SystemInfoFactory.
SystemInfo.getBasicInformation() (or whatever) could return a map of
settings. JavaSystemInfo will fill in those values as best it can (and
null out those it cannot determine) and have NativeSystemInfo do all the
SIGAR-y things to get the values of the things you need.
Again, I don't know what this templat engine does extract - I'm merely
going by what I think the native stuff (SystemInfo, SystemInfoFactory)
should be doing - that being, returning a basic map of information about
the platform. How that gets applied to some piece of content via a
templating engine seems to be outside the scope of the SystemInfo API
and should be in, say, plugin API.
_______________________________________________
rhq-users mailing list
rhq-users(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhq-users
Mazz, The factory method returns a new TemplateEngine populated with
values that are read out of the SystemInfo object.
In short:
public static TemplateEngine fetchTemplateEngine() {
SystemInfo systemInfo = createSystemInfo();
Map<String, String> tokens = new HashMap<String, String>();
tokens.put(TOKEN_PREFIX+"hostname", systemInfo.getHostname());
....
TemplateEngine templateEngine = new TemplateEngine(tokens);
return templateEngine;
}
That works already. Since there is no behvior specific to the
underlying platofrm, it does not make sense to delegate that to the
Object that implements SystemInfo. I could have as easily moved it into
a separate factory, but there seemed to be no good reason to do so.