Now I am using FortressConfig this way:

   final FortressConfig config = new FortressConfig();
   config.setContextDirectory("");
   config.setWorkDirectory("");
   config.setContainerConfiguration("report.xconf");
   config.setRoleManagerConfiguration("report.roles");
   config.setLoggerManagerConfiguration("logkit.xconf");

ContainerManager cm = new
DefaultContainerManager(config.getContext());
ContainerUtil.initialize( cm ); DefaultContainer container = (DefaultContainer) cm.getContainer();
ServiceManager manager = container.getServiceManager();


you can tell that I use FortressConfig only to get a ServiceManager to lookup services, So I provided it two files: report.xconf and report.roles.

report.xconf

<my-system>
 <AnotherRunner id="Runner.Another" name="I M ANOTHER RUNNER"/>
 <DefaultRunner id="Runner.Default" name="I M DEFAULT RUNNER"/>
</my-system>

report.roles

<?xml version="1.0"?>
<role-list>
<role name="Runner">
<component shorthand="DefaultRunner"
class="DefaultRunner"
/>
<component shorthand="AnotherRunner"
class="AnotherRunner"
/>
</role> </role-list>



when I use config.getContext()) to get a Context for the ContainerManager, I guess the returned Context object contains the content of the two files provided to look up services. But, the question is, I have another Context object which is not supposed to be used for looking up services, for example: system.xconf


system.xconf

<system>
<ColorsConfig path="file://colors.xml" />
<DevicesConfig path="file://devices.xml" />
</system>

and I want every service which implemented Contextualiziable interface I look up through the manager(a Servicemanager) to be able to access that context(contains the content of system.xconf), what shall I do then? I checked FortressConfig class API yet got no clues.


Yet actually in ECM , I achived my goal this way


ExcaliburComponentManager manager=new ExcaliburComponentManager();
DefaultRoleManager roles = new DefaultRoleManager();
roles.configure(roleConfig);//report.roles
manager.setRoleManager(roles);
manager.configure(managerConfig)//report.xconf
manager.contextualize(sysContext);//system.xconf

then whenever I lookup a Component using that manager, it can access that sysContext Object



Thanks
Mike.

_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/



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



Reply via email to