Hi,

On Wed, 13 Feb 2002 10:31, Stephen McConnell wrote:
> Pete:
>
> I'm working though Phoenix code trying to sort out how I
> can introduce a different LifecycleHelper implementation.
> Basically I need Phoenix to provide support for the
> Serviceable interface which means I needs to declare somewhere
> an alternative application processing model.  I've basically
> got to the point where DefaultApplication is probably the class
> I need to specialise (because it creates the new instance of
> LifecycleHelper), however, I haven't resolved how to get
> Phoenix to use a different Application class.  Could this
> be something declared in the assembly.xml or environment.xml?
> Thoughts ?

Goto line 116 in DefaultKernel and change the following line

application = new DefaultApplication(entry.getMetaData());

to something like

application = createApplication();

//this method needs to be added to applicaiton interface
application.setMetaData(entry.getMetaData()); 


And then make the kernel Parameterizable and add a method that looks like

private Application createApplication()
{
  final String className = 
     m_parameters.getParameter( Application.ROLE, 
                                DefaultApplication.class.getName() );

  try
  {
    final ClassLoader classLoader = getClass().getClassLoader();
    final Class clazz = classLoader.loadClass( className );
    return clazz.newInstance();
  }
  catch( ... ) { ... }
}

This was how it was originally designed but I removed that abstraction at one 
stage. Then add a switch to CLIHandler (or whatever it is called) to specifcy 
a property of your alternate applicaiton object.


-- 
Cheers,

Pete

------------------------------------------
I just hate 'yes' men, don't you Smithers?
------------------------------------------

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

Reply via email to