You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Jeremias Maerki <je...@outline.ch> on 2001/12/20 16:32:10 UTC

Re: Avalon and J2EE : Best practices

Hi Vincent

Today, I've taken your collected thoughts and put them to use. They were
very clear and helpful and I'm quite pleased with the results. Well, I
haven't done any direct EJB testing, yet. I've expected pitfalls but
there weren't any until now. I think it would be very helpful if these
ideas could be integrated into Berin's "Developing with Avalon" at some
time. I'd gladly help doing it as soon as I've finished those two
projects I'm currently working on (that will be the beginning of March,
I think).

On Sat, 10 Nov 2001 18:04:51 -0000 Vincent Massol wrote:
> Hi,
> 
> I have just finished reading the excellent "Developing with Avalon" PDF
> (thanks Berin !) and am very eager to introduce Avalon in my current project
> : e-business project using J2EE 1.3.
> 
> Here is how I view the integration. I'd like to have feedback in order to
> confirm this is the best way to use Avalon in J2EE :

<snip/>

> What do you think ? Am I missing something ? As someone already done this ?

Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch


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


Re: Avalon and J2EE : Best practices

Posted by Berin Loritsch <bl...@apache.org>.
Jeremias Maerki wrote:

> Hi Vincent
> 
> Today, I've taken your collected thoughts and put them to use. They were
> very clear and helpful and I'm quite pleased with the results. Well, I
> haven't done any direct EJB testing, yet. I've expected pitfalls but
> there weren't any until now. I think it would be very helpful if these
> ideas could be integrated into Berin's "Developing with Avalon" at some
> time. I'd gladly help doing it as soon as I've finished those two
> projects I'm currently working on (that will be the beginning of March,
> I think).


We would welcome the donation!


> 
> On Sat, 10 Nov 2001 18:04:51 -0000 Vincent Massol wrote:
> 
>>Hi,
>>
>>I have just finished reading the excellent "Developing with Avalon" PDF
>>(thanks Berin !) and am very eager to introduce Avalon in my current project
>>: e-business project using J2EE 1.3.
>>
>>Here is how I view the integration. I'd like to have feedback in order to
>>confirm this is the best way to use Avalon in J2EE :
>>
> 
> <snip/>
> 
>>What do you think ? Am I missing something ? As someone already done this ?
>>
> 
> Cheers,
> Jeremias Märki
> 
> mailto:jeremias.maerki@outline.ch
> 
> OUTLINE AG
> Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
> Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
> Internet http://www.outline.ch
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> .
> 
> 



-- 

"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>


RE: Avalon and J2EE : Best practices

Posted by Vincent Massol <vm...@octo.com>.

> -----Original Message-----
> From: Jason van Zyl [mailto:jvanzyl@zenplex.com]
> Sent: 20 December 2001 21:17
> To: Avalon Developers List
> Subject: Re: Avalon and J2EE : Best practices
> 
> On 12/20/01 1:04 PM, "Vincent Massol" <vm...@octo.com> wrote:
> 
> > - In order to consistently do logging (with Log4J) and configuration
> > (single system configuration file) in both J2EE component and Avalon
> > components, we have done the following :
> >
> > * Created a Logger component,
> > * Created a Configuration component (that uses properties file - I
will
> > submit it for Excalibur in beginning of January),
> > * Defined an AbstractComponent class that is Composable, retrieve
the
> > Logger and Configuration components from the CM and offers 2 getters
:
> 
> Simply as a point of interest, in the course of looking at using
Avalon
> with
> Turbine I did much the same in stratum (which is the refactoring of
all
> the
> tools that have grown in turbine, a turbine commons of sorts) in order
to
> do
> what need to do vis-à-vis logging and configuration.
> 

I guess there must have been a hard discussion at the beginning of
Avalon to decide whether to promote logging and configuration as
lifecycle interface rather than components ... ;-)

In the service framework I had written (babel on sourceforge), I had
decided to implement them as component but I had a BaseLog and
BaseConfig classes which was used for all logging and configuration
related to the Component Manager itself (because it is possible it fails
before the logging service is initialized or if there is no logging
service registered - same for the configuration). However, in the
implementation, the logging and configuration components were actually
using the BaseXXX classes.

[snip] 

-Vincent



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


Re: Avalon and J2EE : Best practices

Posted by Jason van Zyl <jv...@zenplex.com>.
On 12/20/01 1:04 PM, "Vincent Massol" <vm...@octo.com> wrote:
 
> - In order to consistently do logging (with Log4J) and configuration
> (single system configuration file) in both J2EE component and Avalon
> components, we have done the following :
> 
> * Created a Logger component,
> * Created a Configuration component (that uses properties file - I will
> submit it for Excalibur in beginning of January),
> * Defined an AbstractComponent class that is Composable, retrieve the
> Logger and Configuration components from the CM and offers 2 getters :

Simply as a point of interest, in the course of looking at using Avalon with
Turbine I did much the same in stratum (which is the refactoring of all the
tools that have grown in turbine, a turbine commons of sorts) in order to do
what need to do vis-à-vis logging and configuration.

> getLogger() and getConfiguration()
> * Our Avalon components extends AbstractComponent
> * We have a ComponentUtilities static class for other non EJB and non
> Avalon classes (during the migration phase and before all non EJB
> classes are components or attached to components) :
> 
> public final static ComponentManager getComponentManager()
> {
>   // Get CM from static variable
>   return InitialisationEJB.manager;
> }
> 
> public final static Component getComponent(String role)
> {
>   final ComponentManager manager = getComponentManager();
>   Component component;
>   try
>   {
>       component = manager.lookup(role);
>   }
>   catch (ComponentException e)
>   {
>       throw new CriticalException("cannot get component for role [" +
>           role + "]", e);
>   }
>   
>   return component;
> }
> 
> * We have defined a AbstractEnterpriseBean class that extends
> AbstractComponent. It contains empty EJB lifecycle methods that are
> common to session beans and entity beans. In the default constructor, we
> call :
> 
> compose(ComponentUtilities.getComponentManager());
> 
> * We also have a AbstractSessionBean and AbstractEntityBean classes that
> extend AbstractEnterpriseBean and simply add the empty EJB lifecycle
> methods related to Session beans and entity beans respectively.
> * We have a EJBUtilities class with static methods to get EJB home and
> bean reference (saved as static variables). We will probably move this
> class to be a single threaded Avalon component in the future.
> 
> Thus we are able :
> - to use Avalon Components
> - to use standard java classes (to be migrated to components in the
> future or will act as helper classes of components)
> - to use EJBs
> - All 3 kinds can call each other with no problem
> - All 3 kind use a unified system configuration file
> - All 3 kind use a unified logging service (based on Log4j)
> 
>> I think it would be very helpful if these
>> ideas could be integrated into Berin's "Developing with Avalon" at
> some
>> time. I'd gladly help doing it as soon as I've finished those two
>> projects I'm currently working on (that will be the beginning of
> March,
>> I think).
>> 
> 
> definitely. + a sample j2ee application that shows it all.
> 
> -Vincent
> 
>> On Sat, 10 Nov 2001 18:04:51 -0000 Vincent Massol wrote:
>>> Hi,
>>> 
>>> I have just finished reading the excellent "Developing with Avalon"
> PDF
>>> (thanks Berin !) and am very eager to introduce Avalon in my current
>> project
>>> : e-business project using J2EE 1.3.
>>> 
>>> Here is how I view the integration. I'd like to have feedback in
> order
>> to
>>> confirm this is the best way to use Avalon in J2EE :
>> 
>> <snip/>
>> 
>>> What do you think ? Am I missing something ? As someone already done
>> this ?
>> 
>> Cheers,
>> Jeremias Märki
>> 
>> mailto:jeremias.maerki@outline.ch
>> 
>> OUTLINE AG
>> Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
>> Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
>> Internet http://www.outline.ch
>> 
>> 
>> --
>> To unsubscribe, e-mail:   <mailto:avalon-dev-
>> unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail: <mailto:avalon-dev-
>> help@jakarta.apache.org>
>> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



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


RE: Avalon and J2EE : Best practices

Posted by Vincent Massol <vm...@octo.com>.

> -----Original Message-----
> From: Jeremias Maerki [mailto:jeremias.maerki@outline.ch]
> Sent: 20 December 2001 15:32
> To: Avalon Developers List
> Subject: Re: Avalon and J2EE : Best practices
> 
> Hi Vincent
> 
> Today, I've taken your collected thoughts and put them to use. They
were
> very clear and helpful and I'm quite pleased with the results. Well, I
> haven't done any direct EJB testing, yet. I've expected pitfalls but
> there weren't any until now. 

Thanks Jeremias. We have made progress with our application and have now
completely integrated Avalon and J2EE and it works fine.

Here are some ideas (I will try to find some time later in January to
participate in a chapter on J2EE integration in "Developing With Avalon"
and to package a sample application showing it in real) :

- With WL 6.1, it is not possible to specify that a war should be
deployed before an EJB jar. Thus we had to move the initialization of
Excalibur CM to an EJB that we package in a separate EJB jar. Then, it
is possible with WL 6.1 to explicitely define the deployment order of
EJB jar. We save the CM as a static variable or this initialization EJB.

- In order to consistently do logging (with Log4J) and configuration
(single system configuration file) in both J2EE component and Avalon
components, we have done the following :

* Created a Logger component,
* Created a Configuration component (that uses properties file - I will
submit it for Excalibur in beginning of January),
* Defined an AbstractComponent class that is Composable, retrieve the
Logger and Configuration components from the CM and offers 2 getters :
getLogger() and getConfiguration()
* Our Avalon components extends AbstractComponent
* We have a ComponentUtilities static class for other non EJB and non
Avalon classes (during the migration phase and before all non EJB
classes are components or attached to components) :

public final static ComponentManager getComponentManager()
{
    // Get CM from static variable
    return InitialisationEJB.manager;
}

public final static Component getComponent(String role)
{
    final ComponentManager manager = getComponentManager();
    Component component;
    try
    {
        component = manager.lookup(role);
    }
    catch (ComponentException e)
    {
        throw new CriticalException("cannot get component for role [" + 
            role + "]", e);
    }
    
    return component;
}

* We have defined a AbstractEnterpriseBean class that extends
AbstractComponent. It contains empty EJB lifecycle methods that are
common to session beans and entity beans. In the default constructor, we
call :

compose(ComponentUtilities.getComponentManager());

* We also have a AbstractSessionBean and AbstractEntityBean classes that
extend AbstractEnterpriseBean and simply add the empty EJB lifecycle
methods related to Session beans and entity beans respectively.
* We have a EJBUtilities class with static methods to get EJB home and
bean reference (saved as static variables). We will probably move this
class to be a single threaded Avalon component in the future.

Thus we are able :
- to use Avalon Components
- to use standard java classes (to be migrated to components in the
future or will act as helper classes of components)
- to use EJBs
- All 3 kinds can call each other with no problem
- All 3 kind use a unified system configuration file
- All 3 kind use a unified logging service (based on Log4j)

> I think it would be very helpful if these
> ideas could be integrated into Berin's "Developing with Avalon" at
some
> time. I'd gladly help doing it as soon as I've finished those two
> projects I'm currently working on (that will be the beginning of
March,
> I think).
> 

definitely. + a sample j2ee application that shows it all.

-Vincent

> On Sat, 10 Nov 2001 18:04:51 -0000 Vincent Massol wrote:
> > Hi,
> >
> > I have just finished reading the excellent "Developing with Avalon"
PDF
> > (thanks Berin !) and am very eager to introduce Avalon in my current
> project
> > : e-business project using J2EE 1.3.
> >
> > Here is how I view the integration. I'd like to have feedback in
order
> to
> > confirm this is the best way to use Avalon in J2EE :
> 
> <snip/>
> 
> > What do you think ? Am I missing something ? As someone already done
> this ?
> 
> Cheers,
> Jeremias Märki
> 
> mailto:jeremias.maerki@outline.ch
> 
> OUTLINE AG
> Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
> Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
> Internet http://www.outline.ch
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-dev-
> help@jakarta.apache.org>
> 




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