The Bundle class


Every project has a class that is generated by the archetype that extends com.bmc.arsys.services.common.RxBundle.  As generated by the archetype, this class simply activates your code bundle at deployment time, which by default has no custom code in it.  It also registers the URL for static resources that are part of your application. 

The archetype generates it in the bundle sub-package of the "package" name you provided with the archetype.

The following code snippet is DUMMY code to generally explain the bundle class and how various extension objects are registered.  Don't worry about what these extension objects are just yet, but as you go through the tutorial, note what the sample code puts here.  For your own extensions, you would have to return to this class whenever you want to activate any of these services.

Important

As you will quickly learn when coding your own services, forgetting to register your implementations here is the first thing to check when your code does not seem to be invoked at run-time!


A Bundle Class - Pseudo-code
package com.example.bundle;

import com.bmc.arsys.rx.services.common.RxBundle;
import com.bmc.arsys.rx.services.common.domain.WebResourceDefinition;
import com.example.bundle.application.MealOrderCSVResource;
import com.example.bundle.application.MealOrderResource;
import com.example.bundle.application.command.CancelMealOrderCommand;
import com.example.bundle.application.datapage.MealOrderDataPageQuery;
import com.example.bundle.business.impl.MealOrderServiceImpl;

/**
 * Rx Web Activator class.
 */

public class MyApplication extends RxBundle {

   /* (non-Javadoc)
     * @see com.bmc.arsys.rx.business.common.RxBundle#register()
     */

   @Override
   protected void register() {
       //
       // TODO: Register static web resources and framework extensions.
       //
       // registerService(new MyService());
       //

       // Register Commands
       registerClass(CancelMealOrderCommand.class);

       // Register Data Page Queries
       registerClass(MealOrderDataPageQuery.class);

       // Register Services
       registerService(new MealOrderServiceImpl());

       // Register Resources
       registerRestfulResource(new MealOrderResource());
        registerRestfulResource(new MealOrderCSVResource());

        registerStaticWebResource(String.format("/%s", getId()), "/webapp");
   }
}

It is also possible to place custom code in a project created as a coded Application (not a Library) bundle. 

The best way to quickly see which resources and services are in the meal-program-lib bundle, just examine the bundle class where you will find:

MyLibrary.java - snippet
         // ...
        // Register Commands
       registerClass(CancelMealOrderCommand.class);

       // Register Data Page Queries
       registerClass(MealOrderDataPageQuery.class);

       // Register Services
       registerService(new MealOrderServiceImpl());

       // Register Resources
       registerRestfulResource(new MealOrderResource());
        registerRestfulResource(new MealOrderCSVResource());
       // ...  



 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*