<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 8/3/2016 3:58 PM, James Perkins
      wrote:<br>
    </div>
    <blockquote
cite="mid:CADGwLpj5azm=HVEoiFur739e8aeW5eOsKdE4OKEoos=krYVfOg@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Wed, Aug 3, 2016 at 6:53 AM, Stan
            Silvert <span dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">The
              Keycloak server is currently configured via a
              keycloak-server.json<br>
              file.  We are converting this to configuration through<br>
              standalone.xml/domain.xml.<br>
              <br>
              To automatically upgrade, I need to read
              keycloak-server.json and write<br>
              back to standalone.xml.  I can easily add the operations
              to do this at<br>
              parse time.  The parser has this method:<br>
              <br>
              @Override<br>
              public void readElement(final XMLExtendedStreamReader
              reader, final<br>
              List&lt;ModelNode&gt; list) throws XMLStreamException<br>
            </blockquote>
            <div><br>
            </div>
            <div>Reading an external resource from the subsystem parsing
              doesn't feel right to me. Is the goal to move away from
              the keycloak-server.json to using the management model?</div>
          </div>
        </div>
      </div>
    </blockquote>
    Yes, that's the goal.  I'd like it to happen automatically when the
    server is upgraded to a new version of the Keycloak subsystem.  So
    we need to read keyclaok-server.json and write to
    standalone.xml/domain.xml.<br>
    <blockquote
cite="mid:CADGwLpj5azm=HVEoiFur739e8aeW5eOsKdE4OKEoos=krYVfOg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>If that is the goal then a better solution might be to
              have some sort of migration operation that would read the
              file and create the subsystem model. Then after that the
              keycloak-server.json is ignored and the *.xml file will be
              used.</div>
          </div>
        </div>
      </div>
    </blockquote>
    That's exactly what I am trying to accomplish.  I can create the
    subsystem model easily.  But a write to standalone.xml doesn't
    happen during server startup.<br>
    <blockquote
cite="mid:CADGwLpj5azm=HVEoiFur739e8aeW5eOsKdE4OKEoos=krYVfOg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <br>
              So one way to do this is to parse keycloak-server.json at
              this time and<br>
              add operations to the list.<br>
              <br>
              That puts everything into the management model.  But
              nothing will be<br>
              written to standalone.xml unless someone manually does a
              write operation<br>
              from CLI.<br>
            </blockquote>
            <div><br>
            </div>
            <div>A write will be triggered if you make a change to the
              management model.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <br>
              So my question is, what is the best way to accomplish
              this?  Is there a<br>
              good, safe way to manually trigger a flush to
              standalone.xml at this<br>
              point or at some later point during startup?<br>
            </blockquote>
            <div><br>
            </div>
            <div>Not really an answer, but I hope there is not a way to
              trigger a write :)</div>
          </div>
        </div>
      </div>
    </blockquote>
    This could be done without harm as long as it is managed properly. 
    <br>
    <br>
    If there is no way to do it then I'll have to make it a separate
    operation that the administrator has to run using offline CLI. 
    That's far from ideal as I would rather it happen automatically as
    part of the upgrade.<br>
    <blockquote
cite="mid:CADGwLpj5azm=HVEoiFur739e8aeW5eOsKdE4OKEoos=krYVfOg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <br>
              Stan<br>
              _______________________________________________<br>
              wildfly-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
              <a moz-do-not-send="true"
                href="https://lists.jboss.org/mailman/listinfo/wildfly-dev"
                rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>James R. Perkins</div>
                  <div>JBoss by Red Hat</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>