avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject RE: Component Transactions
Date Fri, 07 Jun 2002 13:19:13 GMT
> From: Peter Donald [mailto:peter@apache.org] 
> 
> Hi,
> 
> Glad to see that Berin has finally come over to the dark side ;)
> 
> Two points to make (they may be familiar to you);
> 
> Object Role?
> -------------------
> 
> Why do we need Object passed in as Role key? Why couldn't we 
> have a String 
> passed in. And if we were going to pass in a string then why don't we 
> concaternate the strings on clientside and have a simple 
> interface such as
> 
> public interface ServiceManager
> {
>    void lookup(String name) throws ComponentException;
>    boolean exists( String name );
> }

I never said a Role should be an Object, but that we should have a
method for a String role and an Object hint for more complex queries.
That way we don't have to have MyCOmponent.ROLE + "/specific", we
keep the separate parts separate.

> 
> Note that I kept the ComponentException as it should only be 
> raised in 
> error condition.

Yeah, but it needs to be tested for.  If the only thing that can
go wrong on a *lookup* is that a component is not there, we should
make that exception a RuntimeException.  That way components who
assume everything to be OK (the usual case) don't have to do more
work than is necessary.  Others that want to catch the RuntimeException
can still do it.

This is done not by explicitly declaring the exception in the
interface, but in its javadocs:

public interface ServiceManager
{
    /** throws ComponentException if component is not available */
    Object lookup(String role);
    /** throws ComponentException if component is not available */
    Object lookup(String role, Object hint);

    boolean exists( String name ); // do we need more specific version?
}


<snip/>

I will look at the rest of the message in detail
offline.


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message