ExcaliburComponentSelector expects all component hints to
be provided by a "name" attribute:
// ExcaliburComponentSelector.configure() Line 305
Object hint = instances[i].getAttribute( "name" ).trim();
This is insufficient for the general case: we may choose
to use "id" as a hint attribute, for instance. Since hints
are objects (rather than strings), we should be able to
extract even a complex hint object from the configuration.
We may extend the RoleManager interface to add:
public HintSelector getHintSelector();
where HintSelector is defined as:
public interface HintSelector {
public Object selectHint(Configuration conf)
throws ConfigurationException;
}
We may augment the DefaultRoleManager configuration syntax
to add an optional <hint-selector> inner element that
specifies what HintSelector implementation to use.
<role shorthand="tasks"
name="org.plenix.task.TaskSelector"
default-class="org...ExcaliburComponentSelector">
<hint-selector class="org...XXXHintSelector">
<!-- Optional HintSelector configuration here -->
</hint-selector>
<hint shorthand="os-task"
class="org.plenix.task.os.OSTask"/>
<hint shorthand="script-task"
class="org.plenix.task.bsf.ScriptTask"/>
</role>
Left unspecified, the hint selector may default to an
implementation based on the "name" attribute:
public class AttributeHintSelector
implements HintSelector,
Configurable
{
String attributeName;
public void configure(Configuration conf)
throws ConfigurationException
{
this.attributeName =
conf.getAttribute("use-attribute", "name");
}
public Object selectHint(Configuration conf)
throws ConfigurationException
{
return conf.getAttribute(this.attributeName);
}
}
ExcaliburComponentSelector may then assign the hint as
follows:
// ExcaliburComponentSelector.configure() Line 305
Object hint =
m_roles.getHintSelector().selectHint(instances[i]);
What do you guys think?
Regards,
Ricardo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]