com.oracle.svm.core.annotate.Substitute Java Examples

The following examples show how to use com.oracle.svm.core.annotate.Substitute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Target_AbstractMappingContext.java    From spring-graalvm-native with Apache License 2.0 6 votes vote down vote up
@Substitute
protected Target_AbstractMappingContext()  {
	this.persistentPropertyPathFactory = new PersistentPropertyPathFactory<E, P>((AbstractMappingContext)(Object)this);

	EntityInstantiators instantiators = new EntityInstantiators();
	Target_BeanWrapperPropertyAccessorFactory accessorFactory = Target_BeanWrapperPropertyAccessorFactory.INSTANCE;

	this.persistentPropertyAccessorFactory = new InstantiationAwarePropertyAccessorFactory(accessorFactory,
			instantiators);

	NONE = Optional.empty();
	persistentEntities = new HashMap<>();
	evaluationContextProvider = EvaluationContextProvider.DEFAULT;
	initialEntitySet = new HashSet<>();
	strict = false;
	simpleTypeHolder = SimpleTypeHolder.DEFAULT;
	lock = new ReentrantReadWriteLock();
	read = lock.readLock();
	write = lock.writeLock();
}
 
Example #2
Source File: WebClientSubstitution.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Substitute
static JAXRSClientFactoryBean getBean(String baseAddress, String configLocation) {
    JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
    // configLocation is always null and no need to create SpringBusFactory.
    CXFBusFactory bf = new CXFBusFactory();

    // It can not load the extensions from the bus-extensions.txt dynamically.
    // So have to set all of necessary ones here.
    List<Extension> extensions = new ArrayList<>();
    Extension http = new Extension();
    http.setClassname(HTTPTransportFactory.class.getName());
    http.setDeferred(true);
    extensions.add(http);
    ExtensionRegistry.addExtensions(extensions);

    Bus bus = bf.createBus();
    bus.setExtension(new PhaseManagerImpl(), PhaseManager.class);
    bus.setExtension(new ClientLifeCycleManagerImpl(), ClientLifeCycleManager.class);
    bus.setExtension(new ConduitInitiatorManagerImpl(bus), ConduitInitiatorManager.class);

    bean.setBus(bus);
    bean.setAddress(baseAddress);
    return bean;
}
 
Example #3
Source File: Target_SpringApplication.java    From spring-graalvm-native with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Substitute
private <T> Collection<T> getSpringFactoriesInstances(Class<T> type, Class<?>[] parameterTypes, Object... args) {
	List<T> instances;
	if (type.equals(SpringApplicationRunListener.class)) {
		instances = (List<T>) Arrays.asList(new EventPublishingRunListener((SpringApplication)(Object)this, new String[0])); // TODO convert args
		// Error when using it, and we probably should do that at build time
		//AnnotationAwareOrderComparator.sort(instances);
	}
	else if (type.equals(SpringBootExceptionReporter.class)) {
		instances = (List<T>) Arrays.asList(DiagnosticsProvider.getFailureAnalyzers((ConfigurableApplicationContext) args[0])); // Package private
		// Error when using it, and we probably should do that at build time
		//AnnotationAwareOrderComparator.sort(instances);
	}
	else {
		instances = SpringFactoriesLoader.loadFactories(type, null);
	}
	return instances;
}
 
Example #4
Source File: SubstituteMetrics.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
public synchronized void register(Logger logger) {
    //JMX is not supported in the native mode
    //because there is no API for avoiding MBean registration, substitution is used to skip registration
    // enhancement in debezium:https://issues.redhat.com/browse/DBZ-2089
    logger.warn("Metrics are not registered in native mode.");
}
 
Example #5
Source File: BasicAuthCacheAlias.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
@Override
public void put(final HttpHost host, final AuthScheme authScheme) {
    Args.notNull(host, "HTTP host");
    if (authScheme == null) {
        return;
    }
    this.map.put(getKey(host), authScheme);
}
 
Example #6
Source File: PlatformSubstitution.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
List<Object> defaultCallAdapterFactories(Executor callbackExecutor) {
    return Arrays.asList(
            CompletableFutureCallAdapterFactorySubstitution.INSTANCE,
            callbackExecutor != null
                    ? new ExecutorCallAdapterFactorySubstitution(callbackExecutor)
                    : DefaultCallAdapterFactorySubstitution.INSTANCE);
}
 
Example #7
Source File: Target_JsonParserFactory.java    From spring-graalvm-native with Apache License 2.0 5 votes vote down vote up
@Substitute
public static JsonParser getJsonParser() {
	if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
		return new JacksonJsonParser();
	}
	if (ClassUtils.isPresent("com.google.gson.Gson", null)) {
		return new GsonJsonParser();
	}
	return new BasicJsonParser();
}
 
Example #8
Source File: SubstituteBeansWeakCache.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
public V get(K key) {
    Reference<V> reference = this.map.get(key);
    if (reference == null) {
        return null;
    }
    V value = reference.get();
    if (value == null) {
        this.map.remove(key);
    }
    return value;
}
 
Example #9
Source File: DozerOSGiSubstitutions.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
private DozerClassLoader getClassLoader() {
    // Substituted method impl without unwanted references to OSGiClassLoader
    if (fluentDefinedClassLoader == null) {
        return new DefaultClassLoader(DozerBeanMapperBuilder.class.getClassLoader());
    } else {
        return fluentDefinedClassLoader;
    }
}
 
Example #10
Source File: Target_DefaultMethodInvokingMethodInterceptor.java    From spring-boot-graal-feature with Apache License 2.0 5 votes vote down vote up
@Substitute
public Object invoke(MethodInvocation invocation) throws Throwable {
	Method method = invocation.getMethod();
	Object[] arguments = invocation.getArguments();
	Object proxy = ((ProxyMethodInvocation)invocation).getProxy();
	return method.invoke(proxy,arguments);
}
 
Example #11
Source File: SpringJMSSubstitutions.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
protected MessageConsumer createConsumer(Session session, Destination destination) throws JMSException {
    // Removes references to JMS 2.0 shared subscriptions
    if (pubSubDomain && destination instanceof Topic) {
        if (subscriptionDurable) {
            return session.createDurableSubscriber(
                    (Topic) destination, subscriptionName, messageSelector, pubSubNoLocal);
        } else {
            return session.createConsumer(destination, messageSelector, pubSubNoLocal);
        }
    } else {
        return session.createConsumer(destination, messageSelector);
    }
}
 
Example #12
Source File: SunTemplatesImplSubstitution.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
Class<?> defineClass(final byte[] b, ProtectionDomain pd) {
    throw new UnsupportedOperationException();
}
 
Example #13
Source File: SunTemplatesImplSubstitution.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
Class defineClass(final byte[] b) {
    throw new UnsupportedOperationException();
}
 
Example #14
Source File: SunTemplatesImplSubstitution.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
Class defineClass(final byte[] b) {
    throw new UnsupportedOperationException();
}
 
Example #15
Source File: SubstituteBeansWeakCache.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public void clear() {
    this.map.clear();
}
 
Example #16
Source File: HibernateSubstitutions.java    From micronaut-sql with Apache License 2.0 4 votes vote down vote up
@Substitute
public Binding bind(String resource) {
    return null;
}
 
Example #17
Source File: Target_org_hibernate_jpa_boot_internal_PersistenceUnitInfoDescriptor.java    From spring-boot-graal-feature with Apache License 2.0 4 votes vote down vote up
@Substitute
public ClassLoader getTempClassLoader() {
	return  null;
}
 
Example #18
Source File: HibernateSubstitutions.java    From micronaut-sql with Apache License 2.0 4 votes vote down vote up
@Substitute
public Binding bind(File file) {
    return null;
}
 
Example #19
Source File: Target_org_springframework_orm_jpa_persistenceunit_defaultpersistenceunitmanager.java    From spring-boot-graal-feature with Apache License 2.0 4 votes vote down vote up
@Substitute
public URL determineDefaultPersistenceUnitRootUrl() {
	return null;
}
 
Example #20
Source File: Target_AuthenticatorBase.java    From spring-graalvm-native with Apache License 2.0 4 votes vote down vote up
@Substitute
private Optional<AuthConfigProvider> findJaspicProvider() {
	jaspicProvider = Optional.empty();
	return jaspicProvider;
}
 
Example #21
Source File: SubstituteMetrics.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public final void unregister(Logger logger) {
    logger.debug("Metrics are not unregistered in native mode.");
}
 
Example #22
Source File: SpringSubstitutions.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public static Set<Resource> findMatchingResources(
        URL rootDirURL, String locationPattern, PathMatcher pathMatcher) throws IOException {
    throw new UnsupportedOperationException("VFS resources are not supported");
}
 
Example #23
Source File: SpringSubstitutions.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public static Resource getResource(URI uri) throws IOException {
    throw new UnsupportedOperationException("VFS resources are not supported");
}
 
Example #24
Source File: SpringSubstitutions.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public static Resource getResource(URL url) throws IOException {
    throw new UnsupportedOperationException("VFS resources are not supported");
}
 
Example #25
Source File: HibernateSubstitutions.java    From micronaut-sql with Apache License 2.0 4 votes vote down vote up
@Substitute
public NoopJmxService(Map configValues) {
}
 
Example #26
Source File: SpringKotlinSubstitutions.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
static private Type getGenericReturnType(Method method) {
    throw new UnsupportedOperationException("Kotlin is not supported");
}
 
Example #27
Source File: HibernateSubstitutions.java    From micronaut-sql with Apache License 2.0 4 votes vote down vote up
@Override
@Substitute
public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace)
        throws XMLStreamException {
    return null;
}
 
Example #28
Source File: SpringKotlinSubstitutions.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public static <T> T instantiateClass(Constructor<T> ctor, Object... args)
        throws IllegalAccessException, InvocationTargetException, InstantiationException {
    throw new UnsupportedOperationException("Kotlin is not supported");
}
 
Example #29
Source File: SpringKotlinSubstitutions.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public static <T> Constructor<T> findPrimaryConstructor(Class<T> clazz) {
    throw new UnsupportedOperationException("Kotlin is not supported");
}
 
Example #30
Source File: SubstituteDirectoryWatcherBuilder.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
private Builder osDefaultWatchService() throws IOException {
    /* Never call MacOSXListeningWatchService */
    return watchService(FileSystems.getDefault().newWatchService());
}