Hello Ronald,

Some copy&paste of (hidden) code of the Haagse Culltuurserver project you
worked on earlier.

Nico Klasens
Finalist IT Group

public class YourModule extends Module implements Runnable {

        /**
         * @see org.mmbase.module.Module#init()
         */
        public void init() {
                mmb = (MMBase)
org.mmbase.module.Module.getModule("MMBASEROOT");
                // Start thread to wait for mmbase to be up and running.
                new Thread(this).start();
        }

        /**
         * Wait for mmbase to be up and running,
         * then execute the tests.
         */
        public void run() {
                // Wait for mmbase to be up & running.
                while (!mmb.getState()) {
                        try {
                                Thread.sleep(1000);
                        } catch (InterruptedException e) {}
                }
                                
                if (!created()) {
                         log.info("Creating table translations");
                         
                         if (!create() ) {
                                  // can't create table.
                                  // Throw an exception
                                  throw new RuntimeException("Cannot create
table translations.");
                         }
                }
        }
}

-----Oorspronkelijk bericht-----
Van: Ronald Wildenberg [mailto:[EMAIL PROTECTED] 
Verzonden: vrijdag 27 juni 2003 11:30
Aan: '[EMAIL PROTECTED]'
Onderwerp: RE: Can a module use the bridge interface


Hi Rob, thanks for the answer.

Using the bridge interface from a module however, I encounter one problem.
Starting the module leads to the error

   "Couldn't find the MMBaseCop."

Reason for this is that at some point during initialization of my module, I
try to obtain a reference to the Cloud object. This leads to a new
BasicCloud being created and eventually in the constructor of BasicCloud a
reference to MMBaseCop is asked from the MMBASEROOT module. However, this
module has not yet been initialized at that time, because my own module
(chat.xml) comes alphabetically before mmbaseroot.xml.

Is there a way to wait for initialization of other modules?


Regards
Ronald Wildenberg
Finalist IT Group


> -----Oorspronkelijk bericht-----
> Van: Rob van Maris [mailto:[EMAIL PROTECTED]
> Verzonden: vrijdag 27 juni 2003 11:41
> Aan: [EMAIL PROTECTED]
> Onderwerp: RE: Can a module use the bridge interface
> 
> 
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Ronald Wildenberg
> > 
> > My question is whether a module can use the bridge interface or 
> > instead of this should use MMObjectBuilder and related core classes.
> 
> Yes, you can use the bridge interfaces here.
> 
> Personally, I would recommend to use the bridge API to
> implement custom
> functionality, whenever that�s possible. In some cases this is not
> possible or not practical, e.g. when subclassing core classes - like
> MMObjectBuilder.
> 
> Rob van Maris
> 
> Quantiq
> xmedia & communication solutions
> -------------------------------------------------------------
> Koninginneweg 11
> Hilversum, The Netherlands
> -------------------------------------------------------------
> 
>  
> 
> 
> 

Reply via email to