On Mon, 12 Nov 2001 22:11, Paul Hammant wrote:
> OK, I've had an itch about BlockListener for a while in that it is not a
> block (as far as I can see). Can it avail of configuration
yes.
>and
> component-manager services?
no. It gets it components via listening to events.
>
> >blockAdded
> >
> >The logic would be something like the followin
> >
> >class PersistantListener
> >{
> > private Persistor m_persistor;
> > private ArrayList m_persistants = new ArrayList();
> >
> > void blockAdded( BlockEvent event )
> > {
> > final Block block = event.getBlock();
> >
> > if( block instanceof Persistant )
> > {
> > m_persistants.add( block );
> > }
> >
> > if( null == m_persistor && block instanceof Persistor )
> > {
> > m_persistor = (Persistor)block;
> > int size = m_persistants.size();
> > for( int i = 0; i < size; i++ )
> > {
> > final Block other = (Block)m_persistants.get( i );
> > m_persistor.load( (Persistant)other );
> > }
> > }
> > else if( null != _m_persistor )
> > {
> > m_persistor.load( (Persistant)block );
> > }
> > }
> >
> > void blockRemoved()
> > {
> > //reverse above
> > }
> >}
> >
> >So in this case you would have a Persistor Block that persists all the
> > other blocks that want it. We also have Persistent Blocks who want to be
> > persisted. The above code will tell the Persistor about all the
> > persistents in the .sar
> >
> >That work for you ?
>
> Yes it would work, It could be inside the SAR app or outside I presume,
> given the concern above. An Assembler's duty.
Im not sure what you mean outside a .sar ?
--
Cheers,
Pete
---------------------------------------------------
"Therefore it can be said that victorious warriors
win first, and then go to battle, while defeated
warriors go to battle first, and then seek to win."
- Sun Tzu, the Art Of War
---------------------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>