Either use “On-Demand” or “Application” model reader

Just change module JavaGeneration.mqr:

package tutorial.java;
 
public ruleset JavaGeneration(in model : rhapsody) {
 
     entry rule main() {
             // calls the proxy preloader when the connector 
             // "On-Demand" is invoked.
             if (com.sodius.mdw.metamodel.rhapsody.proxy.
                    ProxyPreloader.isProxyModel(model)) {
                    var myProxyPreloader : com.sodius.mdw.metamodel.
                            rhapsody.proxy.ProxyPreloader 
                    = com.sodius.mdw.metamodel.rhapsody
                            .proxy.ProxyPreloader
                            .getNewProxyPreloader(model);
                    myProxyPreloader.preload();
             }
 
             foreach (class : rhapsody.Class in 
                                    model.getInstances("Class")) {
                    $JavaSource(class);
             }
     }
}

 

If RulesComposer indicates a compilation error for the class ProxyPreloader, please open file /META-INF/MANIFEST.MF and add a dependency to:

 

com.sodius.mdw.metamodel.rhapsody.proxy

 

If file /META-INF/MANIFEST.MF is missed, please check if you project is an Eclipse plugin type. You can check it, using right-click on project node, and select command
PDE Tools > Convert Projects to Plug-in Projects…

 

And add dependencies to:

 

com.sodius.mdw.metamodel.rhapsody

com.sodius.mdw.metamodel.rhapsody.proxy

com.sodius.mdw.core

 

Relaunch now the generation and check that generator allows indifferently On-Demand and Application model reader connector.

 

Prev Section: Use filenames associated to objects in Rhapsody