Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1_dev
    • Component/s: admin
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      12,018

      Description

      See: http://wiki.glassfish.java.net/Wiki.jsp?page=3.1Config
      http://wiki.glassfish.java.net/Wiki.jsp?page=CreateCluster

      This feature is for implementing token support in the domain.xml file.

        Issue Links

          Activity

          Hide
          Tom Mueller added a comment -

          Note: adding devtests for this feature is expected before this issue is marked as
          resolved.

          Show
          Tom Mueller added a comment - Note: adding devtests for this feature is expected before this issue is marked as resolved.
          Hide
          Jennifer Chou added a comment -

          Added devtests for
          1) create-cluster --systemproperties
          2) create-instance --systemproperties
          3) create-local-instance --systemproperties

          What else needs to be done to make sure we are resolving the token value
          correctly at runtime?
          What's the best way to test for proper overriding of system-property values?
          cluster should override the value defined at config level, server instance
          should override the value defined at cluster level.

          Show
          Jennifer Chou added a comment - Added devtests for 1) create-cluster --systemproperties 2) create-instance --systemproperties 3) create-local-instance --systemproperties What else needs to be done to make sure we are resolving the token value correctly at runtime? What's the best way to test for proper overriding of system-property values? cluster should override the value defined at config level, server instance should override the value defined at cluster level.
          Hide
          Jennifer Chou added a comment -

          Completed for MS2:

          1) Tokens are interpreted in a remote server instance. When web container asks
          for the HTTP port, it get the real value (8080) instead of $

          {HTTP_PORT}

          .

          Token can be defined at three levels:

          • clusterXYZ-config element
          • clusterXYZ element – overrides clusterXYZ-config
          • serverABC element that are part of that cluster – overrides clusterXYZ

          Implementation
          ==============

          • Updated SystemTasks (core\kernel)setSystemPropertiesFromDomainXml() to look
            for cluster and config system properties. The System Property gets set in
            java.lang.System.setProperty in the correct order of precedence.
            precedence order from high to low
            0. server
            1. cluster
            2. <server>-config or <cluster>-config
            3. domain
          • TranslatedConfigView (admin\config-api) already checks for '$', and retrieves
            the real value of the token from java.lang.System
          • SystemPropertyListener (core\kernel) listens for change events of
            SystemProperty and update the system properties in java.lang.System accordingly.
            Updated logic to include cluster and config system properties. Also fixed up
            remove logic.
          • Issue 12318 SystemPropertyListener not getting change events for Config
            https://glassfish.dev.java.net/issues/show_bug.cgi?id=12318

          2) The above also works for server-config in DAS. In this case, user can define
          token at two levels:

          • server-config element
          • server element

          Implementation
          ==============
          Same implementation logic covers DAS case.

          3) An utility that allows us to get a real value for a token in DAS if it is not
          for server-config. This can be used for administration only.

          Implementation
          ==============

          • PropertyResolver (admin\config-api) Taken from v2.1.1. Use
            GlassFishConfigBean.getRawView(..) to get the raw view ($ {HTTP_LISTENER_PORT}

            ),
            not the already translated view which gets the value from java.lang.System.
            Give this raw view to PropertyResolver.getPropertyValue(rawView) to resolve.

          PropertyResolver pr = new PropertyResolver(domain, instanceName);
          NetworkListener nlRaw = GlassFishConfigBean.getRawView(networkListener);
          String portRaw = nlRaw.getPort();
          String portResolved = pr.getPropertyValue(portRaw);

          Dev Tests
          =========
          1) dev tests for DAS use case - completed. Some tests commented out until
          issues fixed: 12318, 12330.
          2) dev tests for remote instance - in progress
          3) dev tests/unit test for PropertyResolver API - not yet

          Enhanced Feature (https://glassfish.dev.java.net/issues/show_bug.cgi?id=11973):
          Possible to enhance TranslatedConfigView to know about the instance it is
          getting the value for. This is more difficult and will only do this if there is
          more use cases for it. Otherwise, should use the PropertyResolver utility.

          Show
          Jennifer Chou added a comment - Completed for MS2: 1) Tokens are interpreted in a remote server instance. When web container asks for the HTTP port, it get the real value (8080) instead of $ {HTTP_PORT} . Token can be defined at three levels: clusterXYZ-config element clusterXYZ element – overrides clusterXYZ-config serverABC element that are part of that cluster – overrides clusterXYZ Implementation ============== Updated SystemTasks (core\kernel)setSystemPropertiesFromDomainXml() to look for cluster and config system properties. The System Property gets set in java.lang.System.setProperty in the correct order of precedence. precedence order from high to low 0. server 1. cluster 2. <server>-config or <cluster>-config 3. domain TranslatedConfigView (admin\config-api) already checks for '$', and retrieves the real value of the token from java.lang.System SystemPropertyListener (core\kernel) listens for change events of SystemProperty and update the system properties in java.lang.System accordingly. Updated logic to include cluster and config system properties. Also fixed up remove logic. Issue 12318 SystemPropertyListener not getting change events for Config https://glassfish.dev.java.net/issues/show_bug.cgi?id=12318 2) The above also works for server-config in DAS. In this case, user can define token at two levels: server-config element server element Implementation ============== Same implementation logic covers DAS case. 3) An utility that allows us to get a real value for a token in DAS if it is not for server-config. This can be used for administration only. Implementation ============== PropertyResolver (admin\config-api) Taken from v2.1.1. Use GlassFishConfigBean.getRawView(..) to get the raw view ($ {HTTP_LISTENER_PORT} ), not the already translated view which gets the value from java.lang.System. Give this raw view to PropertyResolver.getPropertyValue(rawView) to resolve. PropertyResolver pr = new PropertyResolver(domain, instanceName); NetworkListener nlRaw = GlassFishConfigBean.getRawView(networkListener); String portRaw = nlRaw.getPort(); String portResolved = pr.getPropertyValue(portRaw); Dev Tests ========= 1) dev tests for DAS use case - completed. Some tests commented out until issues fixed: 12318, 12330. 2) dev tests for remote instance - in progress 3) dev tests/unit test for PropertyResolver API - not yet Enhanced Feature ( https://glassfish.dev.java.net/issues/show_bug.cgi?id=11973): Possible to enhance TranslatedConfigView to know about the instance it is getting the value for. This is more difficult and will only do this if there is more use cases for it. Otherwise, should use the PropertyResolver utility.
          Hide
          Tom Mueller added a comment -

          Marking as resolved based on the previous comment.

          Show
          Tom Mueller added a comment - Marking as resolved based on the previous comment.

            People

            • Assignee:
              Jennifer Chou
              Reporter:
              Tom Mueller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: