9 Replies Latest reply on Aug 9, 2007 10:08 AM by porcherg

    context name change

    Tom Baeyens Master

      I was struggling to find a good name for the runtime data structure related to a scope in a process. Most natural would be Scope, but that name collides with the scope in the context. After some thought, I start to be convinced that the following renaming would be worth while:

      Context --> Environment
      Scope --> Context

      So you'ld get

      Environment env = environmentFactory.openEnvironment();
      try {
       ...
      } finally {
       env.close();
      }
      

      An environment would be composed of a number of contexts, like an application context, a block context (referring to the try-finally-block like in the code above), a transaction context, an execution context and so on.

      From a natural language point of view, i think this renaming would make sense. As of course the runtime scope naming problem would be fixed that way:

      runtime data structure for a process scope --> Scope

      The package org.jbpm.ctx would then be renamed to org.jbpm.env

      What do you guys think ?

        • 1. Re: context name change
          Alejandro Guizar Master

          The new names for Context and Scope feel good. I'd even feel inclined to find an alternative for "Context" as it is a heavily overloaded class name, from the JNDI Context. What do you think of PvmContext?

          Renaming ScopeRuntime to Scope collides with the definition class. If we rename that to ScopeDefinition, then we'd have to rename all BPEL activities to the likes of InvokeDefinition, ReceiveDefinition, etc. Not sure if I favor that, as there are many more definition than runtime classes.

          • 2. Re: context name change
            Tom Baeyens Master

            the clash with the bpel scope is indeed a problem. i'll see if my beauty sleep will shine a new light on the situation...

            • 3. Re: context name change
              Tom Baeyens Master

              i completed the name change

              Context --> Environment
              Scope --> Context

              i'm going to call the process runtime scope base class RuntimeProcessScope. It's not that conceise, but that is not a big problem since it is a class that only process language implementors will have to use. It's not part of the commonly used API.

              • 4. Re: context name change
                Tom Baeyens Master

                please keep an eye out for occurrences that i might have forgot to update.

                • 5. Re: context name change
                  Tom Baeyens Master

                  next refactorings will probably be the following:

                  WireScope --> WireContext or ObjectFactory (not yet sure about that) i think ObjectFactory is the most applicable.

                  Also, I'll probably change Environment into an interface and work with a default implementation.

                  • 6. Re: context name change
                    porcherg Novice

                     

                    "tom.baeyens@jboss.com" wrote:
                    please keep an eye out for occurrences that i might have forgot to update.


                    In the WireParser, we have:

                    defaultBindings.addBinding("scope", new ScopeBinding(), CATEGORY_DESCRIPTORS);
                    defaultBindings.addBinding("environment", new ContextBinding(), CATEGORY_DESCRIPTORS);
                    defaultBindings.addBinding("environment-factory", new ContextFactoryBinding(), CATEGORY_DESCRIPTORS);


                    Maybe we should rename:
                    "scope" -> "context"
                    ScopeBinding -> ContextBinding
                    ContextBinding -> EnvironmentBinding
                    ContextFactoryBinding -> EnvironmentFactoryBinding

                    What do you think about it ?

                    • 7. Re: context name change
                      porcherg Novice

                       

                      "tom.baeyens@jboss.com" wrote:

                      Context --> Environment
                      Scope --> Context

                      An environment would be composed of a number of contexts, like an application context, a block context (referring to the try-finally-block like in the code above), a transaction context, an execution context and so on.



                      In the Environment package, there are still many references to scopes. for example, in DefaultEnvironment, we define:
                      public static final String SCOPENAME_APPLICATION = "application";
                       public static final String SCOPENAME_BLOCK = "block";


                      Are these fields referring to Context (and should be renamed) or are they referring to another scope concept ?

                      regards, Guillaume

                      • 8. Re: context name change
                        Tom Baeyens Master

                        good point. i'll do a global search on scope and i should come accross most of those points.

                        that will probably have to wait till later this week since i'm doing concurrency now.

                        • 9. Re: context name change
                          porcherg Novice

                           

                          "porcherg" wrote:

                          In the WireParser, maybe we should rename:
                          "scope" -> "context"
                          ScopeBinding -> ContextBinding
                          ContextBinding -> EnvironmentBinding
                          ContextFactoryBinding -> EnvironmentFactoryBinding


                          I've just made these changes.

                          Guillaume