All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graal.VertxSubstitutions Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
package graal;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.arangodb.shaded.netty.handler.ssl.*;
import com.arangodb.shaded.vertx.core.MultiMap;
import com.arangodb.shaded.vertx.core.Promise;
import com.arangodb.shaded.vertx.core.Vertx;
import com.arangodb.shaded.vertx.core.dns.AddressResolverOptions;
import com.arangodb.shaded.vertx.core.eventbus.EventBusOptions;
import com.arangodb.shaded.vertx.core.eventbus.impl.HandlerHolder;
import com.arangodb.shaded.vertx.core.eventbus.impl.HandlerRegistration;
import com.arangodb.shaded.vertx.core.eventbus.impl.MessageImpl;
import com.arangodb.shaded.vertx.core.eventbus.impl.OutboundDeliveryContext;
import com.arangodb.shaded.vertx.core.impl.ContextInternal;
import com.arangodb.shaded.vertx.core.impl.VertxInternal;
import com.arangodb.shaded.vertx.core.impl.resolver.DefaultResolverProvider;
import com.arangodb.shaded.vertx.core.net.NetServerOptions;
import com.arangodb.shaded.vertx.core.spi.resolver.ResolverProvider;
import com.arangodb.shaded.vertx.core.spi.transport.Transport;

import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManagerFactory;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;

@TargetClass(className = "com.arangodb.shaded.vertx.core.impl.VertxBuilder")
final class Target_com_arangodb_shaded_vertx_core_impl_VertxBuilder {
    @Substitute
    public static Transport nativeTransport() {
        return null;
    }
}

/**
 * This substitution forces the usage of the blocking DNS resolver
 */
@TargetClass(className = "com.arangodb.shaded.vertx.core.spi.resolver.ResolverProvider")
final class TargetResolverProvider {

    @Substitute
    public static ResolverProvider factory(Vertx vertx, AddressResolverOptions options) {
        return new DefaultResolverProvider();
    }
}

@TargetClass(className = "com.arangodb.shaded.vertx.core.net.OpenSSLEngineOptions")
final class Target_com_arangodb_shaded_vertx_core_net_OpenSSLEngineOptions {

    @Substitute
    public static boolean isAvailable() {
        return false;
    }

    @Substitute
    public static boolean isAlpnAvailable() {
        return false;
    }
}

@SuppressWarnings("rawtypes")
@TargetClass(className = "com.arangodb.shaded.vertx.core.eventbus.impl.clustered.ClusteredEventBus")
final class Target_com_arangodb_shaded_vertx_core_eventbus_impl_clustered_ClusteredEventBusClusteredEventBus {

    @Substitute
    private NetServerOptions getServerOptions() {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    public void start(Promise promise) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    public void close(Promise promise) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    public MessageImpl createMessage(boolean send, String address, MultiMap headers, Object body, String codecName) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    protected  void onLocalRegistration(HandlerHolder handlerHolder, Promise promise) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    protected  HandlerHolder createHandlerHolder(HandlerRegistration registration, boolean replyHandler,
            boolean localOnly, ContextInternal context) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    protected  void onLocalUnregistration(HandlerHolder handlerHolder, Promise completionHandler) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    protected  void sendOrPub(OutboundDeliveryContext sendContext) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    protected String generateReplyAddress() {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    protected boolean isMessageLocal(MessageImpl msg) {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    ConcurrentMap connections() {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    VertxInternal vertx() {
        throw new RuntimeException("Not Implemented");
    }

    @Substitute
    EventBusOptions options() {
        throw new RuntimeException("Not Implemented");
    }
}

@TargetClass(className = "com.arangodb.shaded.vertx.core.spi.tls.DefaultSslContextFactory")
final class Target_DefaultSslContextFactory {

    @Alias
    private Set enabledCipherSuites;

    @Alias
    private List applicationProtocols;

    @Alias
    private ClientAuth clientAuth;

    @Substitute
    private SslContext createContext(boolean useAlpn, boolean client, KeyManagerFactory kmf, TrustManagerFactory tmf)
            throws SSLException {
        SslContextBuilder builder;
        if (client) {
            builder = SslContextBuilder.forClient();
            if (kmf != null) {
                builder.keyManager(kmf);
            }
        } else {
            builder = SslContextBuilder.forServer(kmf);
        }
        Collection cipherSuites = enabledCipherSuites;
        builder.sslProvider(SslProvider.JDK);
        if (cipherSuites == null || cipherSuites.isEmpty()) {
            cipherSuites = Target_com_arangodb_shaded_vertx_core_spi_tls_DefaultJDKCipherSuite.get();
        }
        if (tmf != null) {
            builder.trustManager(tmf);
        }
        if (cipherSuites != null && cipherSuites.size() > 0) {
            builder.ciphers(cipherSuites);
        }
        if (useAlpn && applicationProtocols != null && applicationProtocols.size() > 0) {
            builder.applicationProtocolConfig(new ApplicationProtocolConfig(
                    ApplicationProtocolConfig.Protocol.ALPN,
                    ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
                    ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
                    applicationProtocols));
        }
        if (clientAuth != null) {
            builder.clientAuth(clientAuth);
        }
        return builder.build();
    }
}

@TargetClass(className = "com.arangodb.shaded.vertx.core.spi.tls.DefaultJDKCipherSuite")
final class Target_com_arangodb_shaded_vertx_core_spi_tls_DefaultJDKCipherSuite {
    @Alias
    static List get() {
        return null;
    }
}

class VertxSubstitutions {

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy