You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by bill pope <bi...@icommobile.com> on 2002/02/01 16:37:31 UTC

where to use the Component Interface

Hi,
We have written a number of components that are managed by the Excalibur
Component Manager. I have a question regrading the use of the Component
interface. Basically where should it be specified? Should the implementation
class of the component implement it or should the role interface for the
component inherit it.
eg

public class DefaultPersonService implements  Component, PersonService,
Composable, SingleThreaded
{
--
}

or

public interface PersonService inherits Component
{
--
}

If we have the implementation class implementing component the when we issue
a release of the component we must use a cast as below

manager.release((Component)personService);

If we inherit Component in the role interface we can write

manager.release(personManager);

I think the latter is much nicer but as we are new to avalon some guidance
would be much appreciated. In looking through various samples I have seen
both approaches used.

Thanks

Bill


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: where to use the Component Interface

Posted by Berin Loritsch <bl...@apache.org>.
bill pope wrote:

> Hi,
> We have written a number of components that are managed by the Excalibur
> Component Manager. I have a question regrading the use of the Component
> interface. Basically where should it be specified? Should the implementation
> class of the component implement it or should the role interface for the
> component inherit it.
> eg



This is an issue of style.  Obviously, all implementors of that interface
are desiring to be a Component.

> 
> If we have the implementation class implementing component the when we issue
> a release of the component we must use a cast as below
> 
> manager.release((Component)personService);
> 
> If we inherit Component in the role interface we can write
> 
> manager.release(personManager);
> 
> I think the latter is much nicer but as we are new to avalon some guidance
> would be much appreciated. In looking through various samples I have seen
> both approaches used.



That is the consensus of alot of people.  I personally have taken to doing
this, because it just makes things easier.




-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>