Repository: camel Updated Branches: refs/heads/master 9477c5775 -> 16762eaa5
Switched bean-validator to PlatformHelper. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/16762eaa Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/16762eaa Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/16762eaa Branch: refs/heads/master Commit: 16762eaa5474f0cd8a0285f2d5b66d66ee56cff2 Parents: 9477c57 Author: Henryk Konsek <hekon...@gmail.com> Authored: Tue Feb 18 21:27:42 2014 +0100 Committer: Henryk Konsek <hekon...@gmail.com> Committed: Tue Feb 18 21:27:42 2014 +0100 ---------------------------------------------------------------------- .../bean/validator/BeanValidatorComponent.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/16762eaa/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorComponent.java b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorComponent.java index 0de0f7f..b226263 100644 --- a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorComponent.java +++ b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorComponent.java @@ -31,19 +31,14 @@ import org.apache.camel.Endpoint; import org.apache.camel.impl.DefaultComponent; import org.apache.camel.impl.ProcessorEndpoint; +import static org.apache.camel.util.PlatformHelper.isInOsgiEnvironment; + /** * Bean Validator Component for validating Java beans against reference implementation of JSR 303 Validator (Hibernate * Validator). */ public class BeanValidatorComponent extends DefaultComponent { - /** - * Prefix of the OSGi-aware implementations of {@code org.apache.camel.CamelContext} interface (like - * {@code org.apache.camel.core.osgi.OsgiDefaultCamelContext} or - * {@code org.apache.camel.osgi.OsgiSpringCamelContext} ). - */ - private static final String OSGI_CONTEXT_CLASS_PREFIX = "Osgi"; - @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { BeanValidator beanValidator = new BeanValidator(); @@ -105,14 +100,12 @@ public class BeanValidatorComponent extends DefaultComponent { } /** - * Recognizes if component is executed in the OSGi environment. This implementation assumes that component is - * deployed into OSGi environment if it uses implementation of {@code org.apache.camel.CamelContext} with class - * name starting with the "Osgi" prefix. + * Recognizes if component is executed in the OSGi environment. * * @return true if component is executed in the OSGi environment. False otherwise. */ protected boolean isOsgiContext() { - return getCamelContext().getClass().getSimpleName().startsWith(OSGI_CONTEXT_CLASS_PREFIX); + return isInOsgiEnvironment(); } } \ No newline at end of file