From: "Mu Mike" <[EMAIL PROTECTED]> Reply-To: "Avalon framework users" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: fortress:metainfo manager Date: Sat, 17 Jan 2004 09:28:54 +0000
First, thank you guys, under your help,I have successfuly transfered my code using ECM to using fortress, yet I m still using roles files instead of java doc meta info ,now I m trying to remove those roles files and use java doc meta info,and as usual, I need your help.
This is my main class file
public class TestFortress {
public static void main( String[] args ) throws Exception {
final FortressConfig config = new FortressConfig();
config.setContextDirectory("");
config.setWorkDirectory("");
config.setContainerConfiguration("systemTRY.xconf");
ContainerManager cm = new
DefaultContainerManager(config.getContext());
ContainerUtil.initialize( cm );
DefaultContainer container = (DefaultContainer) cm.getContainer();
ServiceManager manager = container.getServiceManager();
Runner service=(Runner)manager.lookup(Runner.ROLE);
System.out.println(service.getName());
container.getServiceManager().release(service);
org.apache.avalon.framework.container.ContainerUtil.dispose( cm );
}
}
This is my service interface public interface Runner { public static final String ROLE="Runner"; public String getName(); }
This is my service implementaion class
/** * @(#) AnotherRunner * * @avalon.component * @avalon.service type="Runner" * @x-avalon.info name="AnotherRunner" * @x-avalon.lifestyle type="pooled" */ public class AnotherRunner extends AbstractRunner{ public String getName() { try{ return configuration.getAttribute("name"); }catch (Exception e) { return null; } }
and This is my systemTRY.xconf
<my-system> <AnotherRunner id="AnotherRunner" name="I M ANOTHER RUNNER"/> </my-system>
and This is the meta file produced using the ant task provided by fortress, it is placed in the same directory as that of the class
#Meta information for com.achievo.AnotherRunner #Sat Jan 17 16:59:09 CST 2004 x-avalon.lifestyle=pooled x-avalon.name=AnotherRunner
and This is the ServiceList file which is in the root directory of my class directory
com.achievo.Runner
I ran the main class TestFortress, but it told me
org.apache.avalon.framework.service.ServiceException: Unable to provide implementation for Runner (Key='Runner')
any one can help?
Thanks Mike
_________________________________________________________________ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]