Yes, that would be a simple, but yet flexible way to "load" a customized
broker to the framework, although bootstrap() must contain a default
implementation as static abstract is not allowed ;-).
-- Ilkka
> -----Original Message-----
> From: ext Rafal Krzewski [mailto:[EMAIL PROTECTED]]
> Sent: 06. February 2001 15:10
> To: Turbine
> Subject: Re: [WISH] Services
>
>
> [EMAIL PROTECTED] wrote:
> >
> > Rafal,
> >
> > It seems that the code below doesn't work as it was meant to. As
> > newInstance() is static, bootstrap() will not call the
> subclassed version of
> > it but the local one. Sorry to bother you so much with my
> small problem, but
> > a working solution would be to simply let the static
> instance member to be
> > protected either at the BaseServiceBroker level or at the
> TurbineServices
> > level. Then it's the task of the extending subclass to
> implement a safe
> > bootstrap() assigning the customized broker.
>
> Yeah, it seems that I tired to be too smart ;-)
>
> What about that:
>
> public class BaseServiceBroker
> extends BaseInitableBroker
> implements ServiceBroker
> {
> /** The single instance of this class */
> protected static ServiceBroker instance = null;
>
> /**
> * This methods allows access to the single instance of this class
> * existing in the system.
> *
> * If the call occurs before the first call to {@link
> #bootstrap(Object)}
> * is made, <code>null</code> will be returned.
> *
> * @returns The ServiceBroker instance.
> */
> public static ServiceBroker getInstance()
> {
> return instance;
> }
>
> /**
> * This method creates new ServiceBroker instance for the system.
> *
> * The ServiceBroker implementation must provide an implementation
> * of bootstrap methods that meeds the following requirements:
> * <ul>
> * <li> If there is an instance of ServiceBroker running,
> it should
> be
> * shut down.
> * <li> All essentional services should be initialized by the time
> this
> * method returns.
> * <li> Precautions should be taken against concurrent
> execution of
> * this method by multiple threads.
> * </ul>
> *
> * @param data The implementation dependent data used to create
> * the essential services.
> */
> public static abstract ServiceBroker bootstrap(Object data);
>
> // ...
> }
>
> Rafal
>
> --
> Rafal Krzewski
> Senior Internet Developer
> mailto:[EMAIL PROTECTED]
> +48 22 8534830 http://e-point.pl
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]