public void apply(InternalObjectContainer container) {
    final Queries queries = Db4oMBeans.newQueriesMBean(container);
    final CommonConfiguration config =
        Db4oLegacyConfigurationBridge.asCommonConfiguration(container.configure());
    config
        .diagnostic()
        .addListener(
            new DiagnosticListener() {
              public void onDiagnostic(Diagnostic d) {
                if (d instanceof LoadedFromClassIndex) {
                  queries.notifyClassIndexScan((LoadedFromClassIndex) d);
                }
              }
            });

    final EventRegistry events = EventRegistryFactory.forObjectContainer(container);
    events
        .queryStarted()
        .addListener(
            new EventListener4<QueryEventArgs>() {
              public void onEvent(Event4<QueryEventArgs> e, QueryEventArgs args) {
                queries.notifyQueryStarted();
              }
            });

    events
        .queryFinished()
        .addListener(
            new EventListener4<QueryEventArgs>() {
              public void onEvent(Event4<QueryEventArgs> e, QueryEventArgs args) {
                queries.notifyQueryFinished();
              }
            });
  }
 public CommonConfiguration common() {
   return Db4oLegacyConfigurationBridge.asCommonConfiguration(legacy());
 }