<commit_before>/* DO NOT EDIT: File is auto-generated */
package <%= to_package(repository.gwt.qualified_abstract_application_name) %>;

@javax.annotation.Generated( "Domgen" )
public abstract class <%= repository.gwt.abstract_application_name %>
<% if repository.keycloak? -%>
    implements org.realityforge.gwt.keycloak.KeycloakListener
<% end -%>
{
<% if repository.keycloak? -%>
  private final org.realityforge.gwt.keycloak.Keycloak _keycloak;
<% end -%>
  private final String _applicationURL;
  private final String _serverUrl;

  protected <%= repository.gwt.abstract_application_name %>(<% if repository.keycloak? -%> @javax.annotation.Nonnull final String keycloakClient <% end -%>)
  {
    final String hostBaseURL = com.google.gwt.core.client.GWT.getHostPageBaseURL();
    final String hostURL = hostBaseURL.substring( 0, hostBaseURL.indexOf( '/', hostBaseURL.indexOf( "://" ) + 3 ) );
    final String moduleBaseURL = com.google.gwt.core.client.GWT.getModuleBaseURL();
    final String moduleHostURL = moduleBaseURL.substring( 0, moduleBaseURL.indexOf( '/', moduleBaseURL.indexOf( "://" ) + 3 ) );
    if( !hostURL.equals( moduleHostURL ) )
    {
      _applicationURL = hostBaseURL;
    }
    else
    {
      _applicationURL = moduleBaseURL.substring( 0, moduleBaseURL.length() - com.google.gwt.core.client.GWT.getModuleName().length() - 1 );
    }
    _serverUrl = _applicationURL.substring( 0, _applicationURL.indexOf( '/', _applicationURL.indexOf( "://" ) + 3 ) );
<% if repository.keycloak? -%>
    _keycloak = new org.realityforge.gwt.keycloak.Keycloak( keycloakClient, _applicationURL + ".keycloak/" + keycloakClient + "/keycloak.json" );
    getKeycloak().setListener( this );
<% end -%>
  }

  public String getApplicationURL()
  {
    return _applicationURL;
  }

  public String getServerUrl()
  {
    return _serverUrl;
  }
<% if repository.keycloak? -%>

  protected abstract com.google.gwt.event.shared.EventBus getEventBus();

  @Override
  public void onReady( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak, final boolean authenticated )
  {
    if ( authenticated )
    {
      start();
    }
    else
    {
      keycloak.login();
    }
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.ReadyEvent( keycloak, authenticated ), keycloak );
    }
  }

  @Override
  public void onAuthSuccess( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthSuccessEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthError( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthErrorEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthRefreshSuccess( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthRefreshSuccessEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthRefreshError( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthRefreshErrorEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void beforeAuthLogout( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.BeforeAuthLogoutEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthLogout( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthLogoutEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onTokenExpired( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.TokenExpiredEvent( keycloak ), keycloak );
    }
  }

  public void login()
  {
    getKeycloak().login();
  }

  public void logout()
  {
    getKeycloak().logout();
  }

  @javax.annotation.Nonnull
  public org.realityforge.gwt.keycloak.Keycloak getKeycloak()
  {
    return _keycloak;
  }
<% end -%>

  public void init()
  {
<% if repository.gwt_rpc? -%>
    initGwtRpcServices();
<% end -%>
<% if repository.keycloak? -%>
    getKeycloak().init();
<% else -%>
    start();
<% end -%>
  }

  public void start()
  {
    preStart();
<% if repository.appcache? -%>
    setupAppCache();
<% end -%>
    setupUncaughtExceptionHandler();
    prepareServices();
    prepareUI();
    postStart();
  }

  private void setupUncaughtExceptionHandler()
  {
    com.google.gwt.core.client.GWT.setUncaughtExceptionHandler( new com.google.gwt.core.client.GWT.UncaughtExceptionHandler()
    {
      @Override
      public void onUncaughtException( final Throwable e )
      {
        <%= repository.gwt.abstract_application_name %>.this.onUncaughtException( e );
      }
    } );
  }
<% if repository.appcache? -%>

  private void setupAppCache()
  {
    final org.realityforge.gwt.appcache.client.ApplicationCache cache = org.realityforge.gwt.appcache.client.ApplicationCache.getApplicationCacheIfSupported();
    if ( null != cache )
    {
      cache.addUpdateReadyHandler( new org.realityforge.gwt.appcache.client.event.UpdateReadyEvent.Handler()
      {
        @java.lang.Override
        public void onUpdateReadyEvent( @javax.annotation.Nonnull final org.realityforge.gwt.appcache.client.event.UpdateReadyEvent event )
        {
          cache.swapCache();
          onAppcacheUpdateReadyEvent();
        }
      } );
    }
  }

  protected abstract void onAppcacheUpdateReadyEvent();
<% end -%>

  protected abstract void postStart();

  protected abstract void preStart();

  protected abstract void prepareServices();

  protected abstract void prepareUI();

  protected void onUncaughtException( Throwable e )
  {
<% if repository.iris_audit? -%>
    final iris.audit.client.ClientExceptionAuditHelper helper = getClientExceptionAuditHelper();
    if ( null != helper )
    {
      helper.auditClientException( e, e.getMessage() );
    }
<% end -%>
  }
<% if repository.gwt_rpc? -%>

  protected void initGwtRpcServices()
  {
<% if repository.keycloak? -%>
    <%= repository.gwt_rpc.qualified_rpc_services_module_name %>.setKeycloak( getKeycloak() );
<% end -%>
    <%= repository.gwt_rpc.qualified_rpc_services_module_name %>.<% if repository.imit? -%>getSessionContext().<% end -%>setBaseURL( getApplicationURL() );
    <%= repository.gwt_rpc.qualified_rpc_services_module_name %>.initialize();
<% if repository.iris_audit? -%>
    iris.audit.client.ioc.AuditGwtRpcServicesModule.setBaseURL( getApplicationURL() );
<% if repository.keycloak? -%>
    iris.audit.client.ioc.AuditGwtRpcServicesModule.setKeycloak( getKeycloak() );
<% end -%>
    iris.audit.client.ioc.AuditGwtRpcServicesModule.initialize();
<% end -%>
  }
<% end -%>
<% if repository.iris_audit? -%>

  @javax.annotation.Nullable
  protected abstract iris.audit.client.ClientExceptionAuditHelper getClientExceptionAuditHelper();
<% end -%>
}
<commit_msg>Add missing nullability annotation<commit_after>/* DO NOT EDIT: File is auto-generated */
package <%= to_package(repository.gwt.qualified_abstract_application_name) %>;

@javax.annotation.Generated( "Domgen" )
public abstract class <%= repository.gwt.abstract_application_name %>
<% if repository.keycloak? -%>
    implements org.realityforge.gwt.keycloak.KeycloakListener
<% end -%>
{
<% if repository.keycloak? -%>
  private final org.realityforge.gwt.keycloak.Keycloak _keycloak;
<% end -%>
  private final String _applicationURL;
  private final String _serverUrl;

  protected <%= repository.gwt.abstract_application_name %>(<% if repository.keycloak? -%> @javax.annotation.Nonnull final String keycloakClient <% end -%>)
  {
    final String hostBaseURL = com.google.gwt.core.client.GWT.getHostPageBaseURL();
    final String hostURL = hostBaseURL.substring( 0, hostBaseURL.indexOf( '/', hostBaseURL.indexOf( "://" ) + 3 ) );
    final String moduleBaseURL = com.google.gwt.core.client.GWT.getModuleBaseURL();
    final String moduleHostURL = moduleBaseURL.substring( 0, moduleBaseURL.indexOf( '/', moduleBaseURL.indexOf( "://" ) + 3 ) );
    if( !hostURL.equals( moduleHostURL ) )
    {
      _applicationURL = hostBaseURL;
    }
    else
    {
      _applicationURL = moduleBaseURL.substring( 0, moduleBaseURL.length() - com.google.gwt.core.client.GWT.getModuleName().length() - 1 );
    }
    _serverUrl = _applicationURL.substring( 0, _applicationURL.indexOf( '/', _applicationURL.indexOf( "://" ) + 3 ) );
<% if repository.keycloak? -%>
    _keycloak = new org.realityforge.gwt.keycloak.Keycloak( keycloakClient, _applicationURL + ".keycloak/" + keycloakClient + "/keycloak.json" );
    getKeycloak().setListener( this );
<% end -%>
  }

  public String getApplicationURL()
  {
    return _applicationURL;
  }

  public String getServerUrl()
  {
    return _serverUrl;
  }
<% if repository.keycloak? -%>

  @javax.annotation.Nullable
  protected abstract com.google.gwt.event.shared.EventBus getEventBus();

  @Override
  public void onReady( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak, final boolean authenticated )
  {
    if ( authenticated )
    {
      start();
    }
    else
    {
      keycloak.login();
    }
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.ReadyEvent( keycloak, authenticated ), keycloak );
    }
  }

  @Override
  public void onAuthSuccess( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthSuccessEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthError( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthErrorEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthRefreshSuccess( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthRefreshSuccessEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthRefreshError( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthRefreshErrorEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void beforeAuthLogout( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.BeforeAuthLogoutEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onAuthLogout( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.AuthLogoutEvent( keycloak ), keycloak );
    }
  }

  @Override
  public void onTokenExpired( @javax.annotation.Nonnull final org.realityforge.gwt.keycloak.Keycloak keycloak )
  {
    if ( null != getEventBus() )
    {
      getEventBus().fireEventFromSource( new org.realityforge.gwt.keycloak.event.TokenExpiredEvent( keycloak ), keycloak );
    }
  }

  public void login()
  {
    getKeycloak().login();
  }

  public void logout()
  {
    getKeycloak().logout();
  }

  @javax.annotation.Nonnull
  public org.realityforge.gwt.keycloak.Keycloak getKeycloak()
  {
    return _keycloak;
  }
<% end -%>

  public void init()
  {
<% if repository.gwt_rpc? -%>
    initGwtRpcServices();
<% end -%>
<% if repository.keycloak? -%>
    getKeycloak().init();
<% else -%>
    start();
<% end -%>
  }

  public void start()
  {
    preStart();
<% if repository.appcache? -%>
    setupAppCache();
<% end -%>
    setupUncaughtExceptionHandler();
    prepareServices();
    prepareUI();
    postStart();
  }

  private void setupUncaughtExceptionHandler()
  {
    com.google.gwt.core.client.GWT.setUncaughtExceptionHandler( new com.google.gwt.core.client.GWT.UncaughtExceptionHandler()
    {
      @Override
      public void onUncaughtException( final Throwable e )
      {
        <%= repository.gwt.abstract_application_name %>.this.onUncaughtException( e );
      }
    } );
  }
<% if repository.appcache? -%>

  private void setupAppCache()
  {
    final org.realityforge.gwt.appcache.client.ApplicationCache cache = org.realityforge.gwt.appcache.client.ApplicationCache.getApplicationCacheIfSupported();
    if ( null != cache )
    {
      cache.addUpdateReadyHandler( new org.realityforge.gwt.appcache.client.event.UpdateReadyEvent.Handler()
      {
        @java.lang.Override
        public void onUpdateReadyEvent( @javax.annotation.Nonnull final org.realityforge.gwt.appcache.client.event.UpdateReadyEvent event )
        {
          cache.swapCache();
          onAppcacheUpdateReadyEvent();
        }
      } );
    }
  }

  protected abstract void onAppcacheUpdateReadyEvent();
<% end -%>

  protected abstract void postStart();

  protected abstract void preStart();

  protected abstract void prepareServices();

  protected abstract void prepareUI();

  protected void onUncaughtException( Throwable e )
  {
<% if repository.iris_audit? -%>
    final iris.audit.client.ClientExceptionAuditHelper helper = getClientExceptionAuditHelper();
    if ( null != helper )
    {
      helper.auditClientException( e, e.getMessage() );
    }
<% end -%>
  }
<% if repository.gwt_rpc? -%>

  protected void initGwtRpcServices()
  {
<% if repository.keycloak? -%>
    <%= repository.gwt_rpc.qualified_rpc_services_module_name %>.setKeycloak( getKeycloak() );
<% end -%>
    <%= repository.gwt_rpc.qualified_rpc_services_module_name %>.<% if repository.imit? -%>getSessionContext().<% end -%>setBaseURL( getApplicationURL() );
    <%= repository.gwt_rpc.qualified_rpc_services_module_name %>.initialize();
<% if repository.iris_audit? -%>
    iris.audit.client.ioc.AuditGwtRpcServicesModule.setBaseURL( getApplicationURL() );
<% if repository.keycloak? -%>
    iris.audit.client.ioc.AuditGwtRpcServicesModule.setKeycloak( getKeycloak() );
<% end -%>
    iris.audit.client.ioc.AuditGwtRpcServicesModule.initialize();
<% end -%>
  }
<% end -%>
<% if repository.iris_audit? -%>

  @javax.annotation.Nullable
  protected abstract iris.audit.client.ClientExceptionAuditHelper getClientExceptionAuditHelper();
<% end -%>
}

{'fraction_non_alphanumeric': 0.13020630595562477, 'fraction_numerical': 0.0010380173867912288, 'mean_word_length': 3.6585071018434574, 'pattern_counts': {'":': 6, '<': 83, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2976825', 'n_tokens_mistral': 5454, 'n_tokens_neox': 5107, 'n_words': 828}