avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neeme Praks <ne...@apache.org>
Subject FortressBean in fortress/tools
Date Wed, 03 Dec 2003 10:07:52 GMT
Didn't seem to get through with first attempt, trying again...

-------- Original Message --------
Subject: 	Re: FortressRunner ant task
Date: 	Mon, 01 Dec 2003 20:22:33 +0200
From: 	Neeme Praks <neeme@apache.org>
To: 	Avalon Developers List <dev@avalon.apache.org>
References: 	<3EDDE286.4050103@apache.org> <3EDDE9F1.7070106@apache.org>



After some delay (almost 6 months :-)) I finally refactored this a bit, 
wrote a testcase for it and commited it as 
org.apache.avalon.fortress.tools.FortressBean.
It can be used as an Ant task or it can also be used to simplify 
embedding scenarios. The testcase is the best example of this, but it 
basically boils down to:
       FortressBean bean = new FortressBean();
       
bean.setRoleManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.roles");
       
bean.setContainerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xconf");
       
bean.setLoggerManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xlog");
       bean.setLookupComponentRole(TestInterface.ROLE); //optional, see 
below
       bean.setInvokeMethod("run"); //optional, see below
       bean.setSystemExitOnDispose(false); //optional, defaults to true
       bean.initialize();
//do something useful, if you configured lookup role and invoke method, 
then you can use bean.run();
//otherwise, if you use it straight from java code then just get the 
servicemanager and do whatever
       this.bean.dispose(); //clean up

Rgds,
Neeme

Berin Loritsch wrote:

> Neeme Praks wrote:
>
>>
>> I have written an Ant task for running Fortress (see attachment). If 
>> this is of general interest then I can beef up the JavaDocs and 
>> commit it. However, the question is then: where should it go? Under 
>> fortress source tree?
>
>
> Excellent.  It should go under src/tools along with the
> MetaInfoCollector.  BTW, the all important question is:
> Can you run JUnit tests against it?
>
>>
>> Example of usage:
>>    <target name="run" depends="compile">
>>            <taskdef name="fortress" 
>> classname="org.apache.avalon.fortress.ant.FortressRunner">
>>                <classpath refid="classpath"/>
>>            </taskdef>
>>            <fortress
>>                
>> containerClass="org.apache.avalon.fortress.impl.DefaultContainer"
>>                contextDirectory="./"
>>                workDirectory="./"
>>                containerConfiguration="resource://app.xconf"
>>                loggerManagerConfiguration="resource://app.xlog"
>>                roleManagerConfiguration="resource://app.roles"
>>
>>                lookupComponentRole="com.mycompany.ui.swing.Runnable/gui"
>>                invokeMethod="run"
>>                />
>>    </target>
>>
>> Rgds,
>> Neeme
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
>> For additional commands, e-mail: dev-help@avalon.apache.org
>
>
>



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


Mime
View raw message