Thanks for Stephen and Niclas' comments.  I have
always appreciated the responds from the avalon list.

FYI, I am trying to generate xinfo files for the
fulcrum.security.hibernate classes by adding @avalon
tags to these classes directly.  You may see
org.apache.fulcrum.security.hibernate.HibernateGroupManagerImpl
and
org.apache.fulcrum.security.spi.AbstractGroupManager
for details.

 --- Stephen McConnell <[EMAIL PROTECTED]>
的郵件內> > (of course empty service() or compose()
methods may be declared, but
> > that's like cutting toes to fit the shoes).
> 
> 
> I like the expression!  But I don't agree with the
> sentiment. If I have 
> an abstract class the dependency declarations at the
> level are relative 
> to the abstract class.  Dependencies declared in a
> derived class are 
> relative to the derived class and will accessed
> (normally) via an 
> overriding service method in the derived class.
> 
>   /**
>    * @avalon.dependency type="Widget" key="widget"
>    */
>    public void service( ServiceManager mgr ) throws
> ServiceException
>    {
>        super.service( mgr );
>        Widget widget = mgr.lookup( "widget" );
>    }

Some examples I have seen have the following
arrangement:

public void service (ServiceManager mgr) throws
ServiceException
{
    this.sm = mgr;
}

public void someMethod ()
{
    Block b = (Block) this.sm.lookup ("name");
}

In this case, wouldn't it make sense to declare
@avalon.dependency for someMethod() instead of
service()?  Or is this a bad coding practice?

> > 2. Wouldn't it be better to have the option of
> putting the dependency
> > declaration under class level javadoc, so that all
> major avalon
> > related tags are collected together?
> 
> Technically - its probably possible, however - there
> is a problem if you 
> want to take advantage of tags to generate enhanced
> javadoc information. 
>   In this case you really want the declaration
> associated with the 
> subject it is qualifying (class, constructor,
> method, etc.).
>
> This also ties in tag scope verification with
> javadoc generation.

Agree.

> > 3. If it is a must-have requirement to have
> @avalon.dependency under
> > these methods only, wouldn't it be nice to
> document it somewhere?
> > (Or maybe I have missed it?)
> 
> Have you see this page:
> 
> http://avalon.apache.org/meta/tools/tags/index.html

I have looked at this link and Niclas' suggestion.  I
see that both examples put @avalon.dependency along
with the service() method.  I thought that only means
that it's a method level tag.  Maybe it's just me.

> > I have been pulling my hair for a few days because
> maven avalon:meta
> > wouldn't generate the xinfo files correctly due to
> this setup.  I am
> > sure others like me would face the same problem. 
> We will really 
> > appreciate if this problem can be solved. :) 
> Thanks.
> 
> My immediate impression is that some enhancements
> related to tag 
> verification would address the main issue.  For
> example - during tag 
> assessment a invalid tag should generate a useful
> error message stating 
> that the tag is declared outside of a recognized
> scope.

That would be great!


BTW, I am facing a problem where Merlin 3.2.5 would
not process the <component><dependencies><dependency/>
key-source association if the dependency declaration
in xinfo does not contain the key attribute.  i.e.

-- block.xml --
     <component name="hello"
class="tutorial.HelloComponent">
       <dependencies>
         <dependency key="primary" source="gloria"/>
         <dependency key="secondary" source="nancy"/>
       </dependencies>
     </component>

-- xinfo --

<type>
  <info>
    <name>simple</name>
    <version>1.0.0</version>
    <lifestyle>singleton</lifestyle>
    <collection>hard</collection>
  </info>
  <dependencies>
    <dependency type="tutorial.Identifiable"/>
    <dependency type="tutorial.Identifiable"/>
  </dependencies>
</type>

-- end --

On the other hand, the avalon:meta goal would not
generate the key attribute if (key.equals (type)). 
However, most of the old components use the component
class name as key.  As a result, it is a bit
inconvinent to use old components in merlin without
either editing xinfo by hand or modifying the
component to use something else as key.  i.e., in
HibernateGroupManagerImpl:

    /**
     * @return Returns the persistenceHelper.
     */
    public PersistenceHelper getPersistenceHelper()
throws DataBackendException
    {
        if (persistenceHelper == null)
        {
            persistenceHelper =
(PersistenceHelper)resolve(PersistenceHelper.ROLE);
        }
        return persistenceHelper;
    }

Any advice for this problem?  Thanks again!

Mandr

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

Reply via email to