All,

as it is now, the ComponentManager will throw an exception if the role
passed to lookup(String) does not match an existing component.

This means that one can in theory write components/composers that adapt
according to the available services by doing something like this:

.
.
.
boolean hasStore = false;
try {
  manager.release (manager.lookup (Store.ROLE));
  hasStore = true;
} catch (ComponentException ce) {
}
.
.
.

But this is ugly, and I have not found a general guideline in the Avalon
docs for this.

I propose the following addition to the ComponentManager interface:

/**
 * Checks if the component manager has a component corresponding
 * to the specified role.
 *
 * @param role the role name
 * @return true if the manager has a component associated with the
 *         given role, false otherwise.
 * @throws ComponentException if an error occurs.
 */
public boolean hasComponent (String role) throws ComponentException;

So the vote is: Should the ComponentManager interface be extended in the way
described above?

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to