| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.apache.camel.component.validator; |
| 18 |
|
|
| 19 |
|
import java.util.Map; |
| 20 |
|
|
| 21 |
|
import org.apache.camel.Endpoint; |
| 22 |
|
import org.apache.camel.Exchange; |
| 23 |
|
import org.apache.camel.component.ResourceBasedComponent; |
| 24 |
|
import org.apache.camel.impl.ProcessorEndpoint; |
| 25 |
|
import org.apache.camel.util.IntrospectionSupport; |
| 26 |
|
|
| 27 |
|
import org.springframework.core.io.Resource; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
2 |
public class ValidatorComponent extends ResourceBasedComponent { |
| 36 |
|
|
| 37 |
|
protected Endpoint<Exchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception { |
| 38 |
2 |
SpringValidator validator = new SpringValidator(); |
| 39 |
2 |
Resource resource = resolveMandatoryResource(remaining); |
| 40 |
2 |
validator.setSchemaResource(resource); |
| 41 |
2 |
if (LOG.isDebugEnabled()) { |
| 42 |
0 |
LOG.debug(this + " using schema resource: " + resource); |
| 43 |
|
} |
| 44 |
2 |
configureValidator(validator, uri, remaining, parameters); |
| 45 |
2 |
return new ProcessorEndpoint(uri, this, validator); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
protected void configureValidator(SpringValidator validator, String uri, String remaining, Map parameters) throws Exception { |
| 49 |
2 |
IntrospectionSupport.setProperties(validator, parameters); |
| 50 |
2 |
} |
| 51 |
|
} |