• how to auto-start bundles

    By Harald Albers 1 decade ago

     

    What is the recommended way to auto-start bundles in a dots environment?</div>
    
    &nbsp;</div>
    
    I want to use an existing domain infrastructure that uses Declarative Services (DS) to manage service dependencies</div>
    
    and JPA/EclipseLink for persistence operations in a dots container.</div>
    
    &nbsp;</div>
    
    DS requires that all bundles that contribute Service Components are started.</div>
    
    EclipseLink requires some system bundles to be started, e.g. javax.persistence and org.eclipse.persistence.jpa.osgi.</div>
    
    &nbsp;</div>
    
    As the dots launcher automatically adds the -clean option to the startup arguments, the bundle state is not persisted.</div>
    
    &nbsp;</div>
    
    The only way I found was to configure the startlevels in {dominodata}/domino/workspace-javaddin/.config/config.ini.</div>
    
    This works but is quite hard to maintain.</div>
    

     

    Are there better options?
    
    
        Are there better options?
    
    
            Are there better options?</div>
    
            &nbsp;</div>
    </div>
    

    Are there better options?What is the recommended way to auto-start bundles in a dots environment?
    
    &nbsp;
    
    I want to use an existing domain infrastructure that uses Declarative Services (DS) to manage service dependencies
    
    and JPA/EclipseLink for persistence operations in a dots container.
    
    &nbsp;
    
    DS requires that all bundles that contribute Service Components are started.
    
    EclipseLink requires some system bundles to be started, e.g. javax.persistence and org.eclipse.persistence.jpa.osgi.
    
    &nbsp;
    
    As the dots launcher automatically adds the -clean option to the startup arguments, the bundle state is not persisted.
    
    &nbsp;
    
    The only way I found was to configure the startlevels in {dominodata}/domino/workspace-javaddin/.config/config.ini.
    
    This works but is quite hard to maintain.
    
    &nbsp;
    
    Are there better options?
    
  • IStartup extension point

    By David Taieb 1 decade ago

    The recommended way is to use the org.opentf.javaddin.IStartup extension point, which is documented in the readme.pdf (since 1.2.0).

    Besides automatically activating the plugin, it calls the earlyStarupt method of the provided IStartup class. In this method, you can manually starts all the plugins you need.

    -david

    • using IStartup for launching prerequisite bundles

      By Harald Albers 1 decade ago

       

      Thanks for the quick reply.</div>
      
      &nbsp;</div>
      
      I already tried to use this extension point for my purposes: I wrote the attached prerequisite bundle launcher that is triggered by the IStartup extension point. It installs several bundle trackers that start the required bundles just when they get available.</div>
      
      &nbsp;</div>
      
      This solution did not work on all machines. In some cases, it always worked, on other machines it always failed. I assume this is due to varying bundle start order over different installations (which might be governed by directory order or file timestamps).</div>
      
      &nbsp;</div>
      
      The IStartup solution works fine for application bundles that just install prerequisite services, but it does not work reliably for basic infrastructure bundles or framework components like DS and EclipseLink. These bundles have to be started really early, and IStartup does not use start levels.</div>
      
      &nbsp;</div>
      
      For such cases, I suggest to introduce dots-specific properties for use in config.ini that can be used to fine-tune the dots environment:</div>
      
      • javaddin.additional.bundles allows you to specify bundles along with their start levels. Its content get appended to osgi.bundles by the launcher.
      • javaddin.clean (boolean) that allows you to suppress workspace cleanup, thus allowing a persistent manual configuration.
      javaddin.clean (boolean) that allows you to suppress workspace cleanup, thus allowing a persistent manual configuration.Thanks for the quick reply.
      
      &nbsp;
      
      I already tried to use this extension point for my purposes: I wrote the attached prerequisite bundle launcher that is triggered by the IStartup extension point. It installs several bundle trackers that start the required bundles just when they get available.
      
      &nbsp;
      
      This solution did not work on all machines. In some cases, it always worked, on other machines it always failed. I assume this is due to varying bundle start order over different installations (which might be governed by directory order or file timestamps).
      
      &nbsp;
      
      The IStartup solution works fine for application bundles that just install prerequisite services, but it does not work reliably for basic infrastructure bundles or framework components like DS and EclipseLink. These bundles have to be started really early, and IStartup does not use start levels.
      
      &nbsp;
      
      For such cases, I suggest to introduce dots-specific properties for use in config.ini that can be used to fine-tune the dots environment:
      
      &nbsp;
      
      javaddin.additional.bundles allows you to specify bundles along with their start levels. Its content get appended to osgi.bundles by the launcher.
      
      javaddin.clean (boolean) that allows you to suppress workspace cleanup, thus allowing a persistent manual configuration.
      
      • Some thoughts

        By David Taieb 1 decade ago

         

        Hi Harald,

        I think having an option for disabling the "clean" startup option is a good idea. I will add it to the next release.

        Also, I looked at your activator file, and I think you can still achieve what you need but using a different method. Instead of using a BundleTrackerCustomizer to activate the bundle you need, you should activate them right away in the start method of your prerequistestarter plugin like so:

         

        public void start(BundleContext context) throws Exception {
        
        &nbsp; &nbsp; for ( String plugin: prerequisites){<br/>
        &nbsp; &nbsp; &nbsp; &nbsp;Platform.getBundle( plugin ).start();<br/>
        &nbsp; &nbsp; }</div>
        
        }
        

        -david

        • it works

          By Harald Albers 1 decade ago

          Thank you very much for the hint, it works.

          Doing it in your suggested way indeed gives me enough control over the bundle startup order to get my infrastructure working.

          For me there is no more need for enhanced startup configuration options in config.ini.