Uploaded image for project: 'WINDUP - Red Hat Application Migration Toolkit'
  1. WINDUP - Red Hat Application Migration Toolkit
  2. WINDUP-409

Allow rules metadata to be specified with annotations - @Rules( phase = ..., ...)

    XMLWordPrintable

Details

    • Story
    • Resolution: Done
    • Major
    • 2.2.0.Final
    • 2.0.0.Beta5, 2.0.0.Final
    • None
    • None

    Description

      We could move some metadata to annotations
      E.g. public RulePhase getPhase() -> @Metadata(phase=...)

      With possibility to override by overriding the method, i.e. default impl would look for annotation.

      (00:54:09) jsightler: Most of our rules aren't java and this isn't really an from that perspective.
      (01:08:19) ozizka-FN: Most of our current rules. We don't know yet what users will really prefer. We should not shape that ratio to our expectations by making one option ugly and verbose.
      (01:08:59) ozizka-FN: Most of our current rules are simple, because we ported them from Windup 0.x, which didn't allow for anything more complex (without additional java code)

      Original:

      public class CheckArchivesWithVictimsRules extends WindupRuleProvider
      {
          @Override
          public RulePhase getPhase()
          {
              return RulePhase.POST_DISCOVERY;
          }
      
          @Override
          public void enhanceMetadata(Context context)
          {
              super.enhanceMetadata(context);
              context.put(RuleMetadata.CATEGORY, "Java/Security");
          }
      
          @Override
          public List<Class<? extends WindupRuleProvider>> getExecuteAfter()
          {
              return asClassList(UpdateVictimsDbRules.class, ComputeArchivesSHA512.class);
          }
          ...
      

      New:

      @Rule( phase =  RulePhase.POST_DISCOVERY, 
         after = { UpdateVictimsDbRules.class, ComputeArchivesSHA512 },
         categories = {"java", "security"}
      )
      public class CheckArchivesWithVictimsRules extends WindupRuleProvider
      {
            ...
      

      Attachments

        Issue Links

          Activity

            People

              ozizka_jira Ondrej Zizka (Inactive)
              ozizka_jira Ondrej Zizka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: