Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve bean validator extension #431

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@

@Recorder
public class BeanValidatorRecorder {
/*
* TODO: remove when rebasing on Camel > 3.0.0-RC3 as camel-main engine
* should automatically bind the ValidatorFactory set-up by Quarkus
* to the component
*/
public RuntimeValue<BeanValidatorComponent> createBeanValidatorComponent() {
return new RuntimeValue<>(new QuarkusBeanValidatorComponent());
}
Expand All @@ -53,11 +58,6 @@ public QuarkusBeanValidatorEndpoint(String endpointUri, Component component) {
super(endpointUri, component);
}

/*
* TODO: we should add an option to programmatically set a ValidatorFactory
* to the BeanValidatorComponent or to automatically look it up from
* the registry
*/
@Override
public Producer createProducer() throws Exception {
final CamelContext camelContext = getCamelContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.component.bean.validator.graal;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import org.apache.camel.component.bean.validator.BeanValidatorEndpoint;

@TargetClass(BeanValidatorEndpoint.class)
final class SubstituteBeanValidatorEndpoint {
@Substitute
protected boolean isOsgiContext() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
*/
package org.apache.camel.quarkus.component.bean.validator.graal;

import javax.validation.ConstraintValidatorFactory;
import javax.validation.MessageInterpolator;
import javax.validation.TraversableResolver;
import javax.validation.ValidationProviderResolver;
import javax.validation.ValidatorFactory;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
Expand All @@ -29,12 +25,9 @@
@TargetClass(ValidatorFactories.class)
final class SubstituteValidatorFactories {
@Substitute
public static ValidatorFactory buildValidatorFactory(
private static ValidationProviderResolver resolveValidationProviderResolver(
boolean osgi,
ValidationProviderResolver validationProviderResolver,
MessageInterpolator messageInterpolator,
TraversableResolver traversableResolver,
ConstraintValidatorFactory constraintValidatorFactory) {
throw new UnsupportedOperationException();
ValidationProviderResolver validationProviderResolver) {
return validationProviderResolver;
}
}