Announcement Announcement Module
No announcement yet.
RCP and plugins (e.g. dynamic Rules) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • RCP and plugins (e.g. dynamic Rules)


    I would like to extend my RCP application. Therefore I have to add additional Rules, Forms and other objects...

    At the moment I have a single RulesSource that is set as property to the DefaultApplicationServices.
    Within my RulesSource implementation I have implemented and added all the Rules I need for my objects.

    But now I want to add a "plugin" (additional jar) that also contains some Rules that should somehow be included into my RulesSource implementation. I don't want to add them into the existing configuration files but have one additional files for every plugin where all configurations concerning the plugin is done.
    But I really don't know how I could add some additional Rules. What is the Spring way?

    Netbeans uses a very interesting approach. There exists some sort of "repository" (a tree like structure) where the child nodes of a special node are interpreted in a "well-known" way. So I would add my custom Rules to a special node (e.g. located under "business/validation/rules"). Does anything similar exist in Spring?


  • #2
    adding Rules in runtime

    I'm not sure if it is what you want, but I did something that may help you.

    In my case, the rules change depending on some business rules. For example, in one scenario my form has fields A anb B required, but in another, it has fields B and C required.

    I didn't find a way to recreate the bean that extends the DefaultRulesSource, because it is registered by another bean that aplyes the rules on the forms.

    So, the solution was to change the existing rules.

    First, take form context the DefaultRulesSource bean.

    In the context:

    <bean id="rulesSource" class="" />
    In your class, call that:

    ValidationRulesSource rulesSource = (ValidationRulesSource) Application.instance()
    Now you have access to the bean tha has all your rules.

    The rules can be grouped by the bean class. Using this information, the framework know waht rules to apply to each form.

    You can get the rules os a specific class like that:

    Rules rules = rulesSource.getRules(YOURBEAN.getClass());
    So, you can create new rules and set them to the rulesSource, like that:
    List<Rules> regras = new ArrayList<Rules>();
    // add your Rules to the list
    Do this before construct the form and it should work.

    I hope this can help you.



    • #3
      Thanks for your answer. This is a way how I solve this special problem. (And thanks for posting it, I will use a similar way to solve my problem temporally)

      But I miss some sort of "extension" mechanism. What I mean is some thing that "collects" implementations of a specific interface.
      Netbeans uses this tree structure, Eclipse its extension points. Isn't there anything like that out there?


      • #4
        take a look at
        or google for spring and osgi


        • #5


          • #6
            I've looked the solution with Osgi.

            If I've understood the solution, Osgi merge each configuration file located in the Bundle (in folder \meta-inf\spring\*.xml)) in a single context file.

            It's possible to add elements to a collection in a Bean defined in another bundle?
            In my "core" bundle i have define the bean "applicationServices" with custom services...

            <bean id="applicationServices"......
            <property name="registryEntries"> // <-- define custom service
            <entry value-ref="lockingBD">

            From "B" Bundle i must add other custom service to "applicationServices" bean defined in "core" bundle , therefore add elements to property registryEntries of "applicationServices" bean

            Other bundle could add custom services (without delete the service defined in bundle b or other bundle)

            There is a solution for merge property of a bean with same id of multiple context?

            other example imageResourcesFactory:
            Each bundle can add its location to property "locations"