Fixes #920.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/38d3e489 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/38d3e489 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/38d3e489 Branch: refs/heads/master Commit: 38d3e489dc45eb0e0956384821cc37857ebeb26f Parents: a818fa1 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Mar 29 08:25:52 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Mar 29 08:25:52 2016 +0200 ---------------------------------------------------------------------- components/camel-cm-sms/pom.xml | 171 ++++++++++--------- .../apache/camel/component/cm/CMComponent.java | 38 +---- 2 files changed, 98 insertions(+), 111 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/38d3e489/components/camel-cm-sms/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-cm-sms/pom.xml b/components/camel-cm-sms/pom.xml index ad44fcb..abb9363 100644 --- a/components/camel-cm-sms/pom.xml +++ b/components/camel-cm-sms/pom.xml @@ -1,95 +1,102 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- 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. --> +<!-- + 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. +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>2.18-SNAPSHOT</version> + </parent> - <parent> - <groupId>org.apache.camel</groupId> - <artifactId>components</artifactId> - <version>2.18-SNAPSHOT</version> - </parent> + <artifactId>camel-cm-sms</artifactId> + <packaging>bundle</packaging> - <artifactId>camel-cm-sms</artifactId> - <packaging>bundle</packaging> + <name>Camel :: CM SMS</name> + <description>Camel CM SMS Gateway Component</description> - <name>Camel :: CM SMS</name> - <description>Camel CM SMS Gateway Component</description> + <properties> + <camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg> + <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm-sms</camel.osgi.export.service> + </properties> - <properties> - <camel.osgi.export.pkg>org.apache.camel.component.cm.*</camel.osgi.export.pkg> - <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=cm-sms</camel.osgi.export.service> - </properties> + <dependencies> - <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - </dependency> + <dependency> + <groupId>com.googlecode.libphonenumber</groupId> + <artifactId>libphonenumber</artifactId> + <version>${libphonenumber-version}</version> + </dependency> - <dependency> - <groupId>com.googlecode.libphonenumber</groupId> - <artifactId>libphonenumber</artifactId> - <version>${libphonenumber-version}</version> - </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient-osgi</artifactId> + <version>${httpclient4-version}</version> + </dependency> + <dependency> + <groupId>org.jsoup</groupId> + <artifactId>jsoup</artifactId> + <version>${jsoup-version}</version> + </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient-osgi</artifactId> - <version>${httpclient4-version}</version> - </dependency> - <dependency> - <groupId>org.jsoup</groupId> - <artifactId>jsoup</artifactId> - <version>${jsoup-version}</version> - </dependency> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>${validation-api-version}</version> + </dependency> + <dependency> + <groupId>javax.el</groupId> + <artifactId>javax.el-api</artifactId> + <version>${javax.el-api-version}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + <version>${hibernate-validator-version}</version> + </dependency> - <dependency> - <groupId>javax.validation</groupId> - <artifactId>validation-api</artifactId> - <version>${validation-api-version}</version> - </dependency> - <dependency> - <groupId>javax.el</groupId> - <artifactId>javax.el-api</artifactId> - <version>${javax.el-api-version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-validator</artifactId> - <version>${hibernate-validator-version}</version> - </dependency> + <!-- test dependencies --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-javaconfig</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> - <!-- test dependencies --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring-javaconfig</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/38d3e489/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java index ec431c2..d32564b 100644 --- a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java +++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java @@ -5,9 +5,9 @@ * 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 - * + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> * 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. @@ -18,7 +18,6 @@ package org.apache.camel.component.cm; import java.util.Map; import java.util.Set; - import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; @@ -28,7 +27,6 @@ import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.ResolveEndpointFailedException; import org.apache.camel.impl.UriEndpointComponent; -import org.apache.camel.util.URISupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,8 +35,7 @@ import org.slf4j.LoggerFactory; */ public class CMComponent extends UriEndpointComponent { - private static final Logger LOG = LoggerFactory - .getLogger(CMComponent.class); + private static final Logger LOG = LoggerFactory.getLogger(CMComponent.class); private Validator validator; @@ -50,21 +47,8 @@ public class CMComponent extends UriEndpointComponent { super(context, CMEndpoint.class); } - /** - * Endpoints factory - */ @Override - protected Endpoint createEndpoint(final String uri, final String remaining, - final Map<String, Object> parameters) - throws Exception { - - LOG.debug("Creating CM Endpoint ... "); - - LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", - new Object[] {URISupport.sanitizeUri(uri), - URISupport - .sanitizePath(remaining), - parameters}); + protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception { // Set configuration based on uri parameters final CMConfiguration config = new CMConfiguration(); @@ -72,23 +56,20 @@ public class CMComponent extends UriEndpointComponent { // Validate configuration LOG.debug("Validating uri based configuration"); - final Set<ConstraintViolation<CMConfiguration>> constraintViolations = getValidator() - .validate(config); + final Set<ConstraintViolation<CMConfiguration>> constraintViolations = getValidator().validate(config); if (constraintViolations.size() > 0) { final StringBuffer msg = new StringBuffer(); for (final ConstraintViolation<CMConfiguration> cv : constraintViolations) { msg.append(String.format("- Invalid value for %s: %s", - cv.getPropertyPath().toString(), - cv.getMessage())); + cv.getPropertyPath().toString(), + cv.getMessage())); } throw new ResolveEndpointFailedException(uri, msg.toString()); } - LOG.debug("CMConfiguration - OK!"); // Component is an Endpoint factory. So far, just one Endpoint type. // Endpoint construction and configuration. - LOG.debug("Creating CMEndpoint"); final CMEndpoint endpoint = new CMEndpoint(uri, this); endpoint.setConfiguration(config); endpoint.setHost(remaining); @@ -98,8 +79,7 @@ public class CMComponent extends UriEndpointComponent { public Validator getValidator() { if (validator == null) { - ValidatorFactory factory = Validation - .buildDefaultValidatorFactory(); + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); } return validator;