I can not vote, but I say +1 for including it. Mark it up as broken, use a
@deprecated tag or move it to a scratchpad directory or *something*. It
provides functions for validating the lifecycle contracts and I think we
should not throw away the code.

I wrote in bugzilla that it should be renamed AbstractComponent. I did not
mean that it should implement all lifecycle methods, but rather provide a
"checkInitialized" method. It is not cruft - remember, the code of a class
only has one instance in the system and it is the data that is unique to
each instance. If there are too many methods, have a

  validateLifecycle (int stage) throws IllegalStateException

with stage being INITIALIZE, COMPOSE, etc.:

public class SimpleComponent extends AbstractComponent implements Component,
Initializable {

      public void initialize () throws Exception
      {
         validateLifecycle (INITIALIZE);

         //do stuff
      }
}

The setWriteOnceObject can be re-declared:

Object setWriteOnceObject (Object source, Object value, String message)

and used as

void compose (ComponentManager manager) {
    this.manager = (ComponentManager) setWriteOnceObject (this.manager,
value, "Already set CM");
}

I do not see two methods which perform some very practical tasks as "cruft".
(Now if only Java supported multiple inheritance...)

/LS

> -----Original Message-----
> From: Berin Loritsch [mailto:[EMAIL PROTECTED]
> Sent: den 30 november 2001 19:32
> To: avalon-dev@jakarta.apache.org
> Subject: [VOTE] ComponentUtil
>
>
> The following snippet is supposed to describe how ComponentUtil
> was envisioned
> to perform.  Unfortunately, Java does not pass primitives by
> reference, but
> by value.
>
> public class SimpleComponent implements Component, Initializable {
>      final int m_mask;
>      int m_state = 0;
>
>      public SimpleComponent()
>      {
>         m_mask = ComponentUtil.getMask(this);
>      }
>
>      public void initialize () throws Exception
>      {
>         ComponentUtil.checkInitialized(m_state);
>
>         //do stuff
>      }
> }
>
>
> If we do not like this usage pattern, then we should choose once
> and for all
> whether to provide it or not.
>
>
> Include ComponentUtil?
>
> Since it is broken and I really want to get Avalon Framework 4.1
> out the door,
> I vote -1, remove it.
>
> --
>
> "They that give up essential liberty to obtain a little temporary safety
>   deserve neither liberty nor safety."
>                  - Benjamin Franklin
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



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

Reply via email to