Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-601

Extending CredentialsAwareLdapAndJdbcUsersManager : change JdbcUsersManager

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 2.2.1
    • None
    • Plugin core
    • None

      I would like to change the JdbcUsersManager of CredentialsAwareLdapAndJdbcUsersManager but I met a problem.

      To do this, I override initialize() method with a super.initialize() call following by my JdbcUsersManager calling.

      But in the initialize() method of CredentialsAwareLdapAndJdbcUsersManager, the JdbcUsersManager is directly call and it generate an exception because I don't have the same parameters into the plugin.xml for my own JdbcUsersManager.

      I suggest to externalize into a protected method the JdbcUsersManager initialization only.

      Currently, we have :

      @Override
      public void initialize() throws Exception
      {
          super.initialize();
          
          // Create the fallback UsersManager and execute all its lifecycle operations.
           _fallbackUsersManager = new ModifiableCredentialsAwareJdbcUsersManager();
          _fallbackUsersManager.contextualize(_context);
          _fallbackUsersManager.setPluginInfo(_pluginName, _featureName);
          _fallbackUsersManager.service(_serviceManager);
          _fallbackUsersManager.configure(_fbConfiguration);
          _fallbackUsersManager.initialize();
          _fallbackUsersManager.enableLogging(getLogger());
      }

      And we should have :

      @Override
      public void initialize() throws Exception
      {
          super.initialize();
          _initializeJdbc();
      }
      
      protected void _initializeJdbc() throws Exception
      {
          // Create the fallback UsersManager and execute all its lifecycle operations.
           _fallbackUsersManager = new ModifiableCredentialsAwareJdbcUsersManager();
          _fallbackUsersManager.contextualize(_context);
          _fallbackUsersManager.setPluginInfo(_pluginName, _featureName);
          _fallbackUsersManager.service(_serviceManager);
          _fallbackUsersManager.configure(_fbConfiguration);
          _fallbackUsersManager.initialize();
          _fallbackUsersManager.enableLogging(getLogger());
          
      }

      Like this, to change the JdbcUsersManager only, I just have to override _initializeJdbc().

            raphael Raphaël Franchet
            bmaurel Bérénice Maurel
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: