Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pluginStack is not encoded into configuration after some event #2002

Open
vladak opened this issue Feb 5, 2018 · 3 comments
Open

pluginStack is not encoded into configuration after some event #2002

vladak opened this issue Feb 5, 2018 · 3 comments
Assignees

Comments

@vladak
Copy link
Member

vladak commented Feb 5, 2018

The pluginStack disappears from encoded Configuration object (acquired using the getconf Message) some time after the webapp is running. It could be after plugin reload.

@vladak vladak added the bug label Feb 5, 2018
@vladak vladak self-assigned this Feb 5, 2018
@vladak
Copy link
Member Author

vladak commented Feb 5, 2018

Actually the stack is there however in reduced form:

  <void id="AuthorizationStack0" property="pluginStack">
   <void property="setup">
    <void method="put">
     <string>configuration</string>
     <string>/opengrok/auth/config/ldap-plugin-config-XXX.xml</string>
    </void>
   </void>
  </void>

So only the "setup" property has survived, the stuff added by "add" method did not.

@vladak
Copy link
Member Author

vladak commented Feb 6, 2018

https://stackoverflow.com/questions/20306992/serialize-object-to-xml-in-java-ignores-some-variable-fields-of-my-object explains the XML encoder behavior (which we have to fight with in the past) and checking getters/setters for the private stack member of AuthorizationStack (and similarly for AuthorizationPlugin) and its instantiation everything seems fine.

Also since sending new config to the webapp the configuration received back contains the previously missing pieces. It cannot be simply reproduced using auth stack reload.

There is one interesting thing about the add method. In the readonly configuration they were all present like this:

   <void property="pluginStack">

            <void method="add">
                <object class="org.opensolaris.opengrok.authorization.AuthorizationPlugin">
                    <void property="name">
                        <string>opengrok.auth.plugin.UserPlugin</string>
                    </void>
                    <void property="flag">
                        <string>REQUISITE</string>
                    </void>
                </object>
            </void>

   </void>

I.e. the add method did not have any specified property within pluginStack to be applied to. It seems there is some logic in XML decoding that does some guessing to which property the method should be applied to however to be on the safe side, the stack property should be added as this is actually what the received configuration has.

I also fixed the example on https://github.com/oracle/opengrok/tree/master/plugins#example-configuration and https://github.com/oracle/opengrok/blob/master/plugins/README.md accordingly.

@tulinkry
Copy link
Contributor

tulinkry commented Oct 4, 2018

I.e. the add method did not have any specified property within pluginStack to be applied to. It seems there is some logic in XML decoding that does some guessing to which property the method should be applied to however to be on the safe side, the stack property should be added as this is actually what the received configuration has.

It has a property, the property is the pluginStack and it's calling this method of the pluginStack:

94  
95      /**
96       * Add a new authorization entity into this stack.
97       *
98       * @param s new entity
99       */
100      public void add(AuthorizationEntity s) {
101          this.stack.add(s);
102      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants