Пример #1
0
  private void removeRemoteIndexingInterceptorFromConfig(Configuration cfg) {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    CustomInterceptorsConfigurationBuilder customInterceptorsBuilder = builder.customInterceptors();

    for (InterceptorConfiguration interceptorConfig : cfg.customInterceptors().interceptors()) {
      if (!(interceptorConfig.asyncInterceptor() instanceof RemoteValueWrapperInterceptor)) {
        customInterceptorsBuilder.addInterceptor().read(interceptorConfig);
      }
    }

    cfg.customInterceptors().interceptors(builder.build().customInterceptors().interceptors());
  }
Пример #2
0
  private void removeQueryInterceptorFromConfiguration(Configuration cfg) {

    ConfigurationBuilder builder = new ConfigurationBuilder();
    CustomInterceptorsConfigurationBuilder customInterceptorsBuilder = builder.customInterceptors();

    for (InterceptorConfiguration interceptorConfig : cfg.customInterceptors().interceptors()) {
      if (!(interceptorConfig.interceptor() instanceof QueryInterceptor)) {
        customInterceptorsBuilder.addInterceptor().read(interceptorConfig);
      }
    }

    cfg.customInterceptors().interceptors(builder.build().customInterceptors().interceptors());
  }
Пример #3
0
 private void writeCustomInterceptors(XMLExtendedStreamWriter writer, Configuration configuration)
     throws XMLStreamException {
   CustomInterceptorsConfiguration customInterceptors = configuration.customInterceptors();
   if (customInterceptors.interceptors().size() > 0) {
     writer.writeStartElement(Element.CUSTOM_INTERCEPTORS);
     for (InterceptorConfiguration interceptor : customInterceptors.interceptors()) {
       AttributeSet attributes = interceptor.attributes();
       writer.writeStartElement(Element.INTERCEPTOR);
       attributes.write(writer, InterceptorConfiguration.INTERCEPTOR_CLASS, Attribute.CLASS);
       attributes.write(writer, InterceptorConfiguration.AFTER, Attribute.AFTER);
       attributes.write(writer, InterceptorConfiguration.BEFORE, Attribute.BEFORE);
       attributes.write(writer, InterceptorConfiguration.INDEX, Attribute.INDEX);
       attributes.write(writer, InterceptorConfiguration.POSITION, Attribute.POSITION);
       writeTypedProperties(writer, interceptor.properties());
       writer.writeEndElement();
     }
     writer.writeEndElement();
   }
 }