You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/08 18:53:29 UTC
[5/5] camel git commit: Polished and added camel-braintree to kit.
This closes #756.
Polished and added camel-braintree to kit. This closes #756.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1962c830
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1962c830
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1962c830
Branch: refs/heads/master
Commit: 1962c830cc348a32e6c12949fd7060110ebeb2a5
Parents: 97358d0
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jan 8 18:50:07 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jan 8 18:50:07 2016 +0100
----------------------------------------------------------------------
apache-camel/pom.xml | 4 ++
.../src/main/descriptors/common-bin.xml | 1 +
components/camel-braintree/pom.xml | 49 +-------------------
.../braintree/BraintreeConfiguration.java | 42 ++---------------
.../component/braintree/BraintreeEndpoint.java | 10 ++--
.../component/braintree/BraintreeProducer.java | 2 +-
6 files changed, 18 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1962c830/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 2e1913c..3646dcd 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -121,6 +121,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-braintree</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/camel/blob/1962c830/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 08ad0b0..9d03471 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -43,6 +43,7 @@
<include>org.apache.camel:camel-blueprint</include>
<include>org.apache.camel:camel-boon</include>
<include>org.apache.camel:camel-box</include>
+ <include>org.apache.camel:camel-braintree</include>
<include>org.apache.camel:camel-cache</include>
<include>org.apache.camel:camel-cassandraql</include>
<include>org.apache.camel:camel-castor</include>
http://git-wip-us.apache.org/repos/asf/camel/blob/1962c830/components/camel-braintree/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-braintree/pom.xml b/components/camel-braintree/pom.xml
index 5df70ad..1beb23e 100644
--- a/components/camel-braintree/pom.xml
+++ b/components/camel-braintree/pom.xml
@@ -59,6 +59,7 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3-version}</version>
</dependency>
+
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
@@ -72,31 +73,6 @@
<scope>test</scope>
</dependency>
-
- <!-- support camel documentation -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>apt</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-nop</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>spi-annotations</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
<!-- Component API javadoc in provided scope to read API signatures -->
<dependency>
<groupId>com.braintreepayments.gateway</groupId>
@@ -128,6 +104,7 @@
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
+
</dependencies>
<build>
@@ -247,28 +224,6 @@
</executions>
</plugin>
- <!-- generate components meta-data and validate component includes documentation etc -->
- <plugin>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-package-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>prepare</id>
- <goals>
- <goal>prepare-components</goal>
- </goals>
- <phase>generate-resources</phase>
- </execution>
- <execution>
- <id>validate</id>
- <goals>
- <goal>validate-components</goal>
- </goals>
- <phase>prepare-package</phase>
- </execution>
- </executions>
- </plugin>
-
<!-- add generated source and test source to build -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
http://git-wip-us.apache.org/repos/asf/camel/blob/1962c830/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
index 49c3dd3..c20c649 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
@@ -54,71 +54,52 @@ public class BraintreeConfiguration {
@Metadata(required = "true")
private String privateKey;
-
- /**
- * @return the environment
- */
public String getEnvironment() {
return ObjectHelper.notNull(environment, ENVIRONMENT);
}
/**
- * @param environment the environment Either SANDBOX or PRODUCTION
+ * The environment Either SANDBOX or PRODUCTION
*/
public void setEnvironment(String environment) {
this.environment = environment;
}
-
- /**
- * @return the merchant id
- */
public String getMerchantId() {
return ObjectHelper.notNull(merchantId, MERCHANT_ID);
}
/**
- * @param merchantId the merchant id provided by Braintree.
+ * The merchant id provided by Braintree.
*/
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
-
- /**
- * @return the public key
- */
public String getPublicKey() {
return ObjectHelper.notNull(publicKey, PUBLIC_KEY);
}
/**
- * @param publicKey the public key provided by Braintree.
+ * The public key provided by Braintree.
*/
public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}
-
- /**
- * @return the private key
- */
public String getPrivateKey() {
return ObjectHelper.notNull(privateKey, PRIVATE_KEY);
}
/**
- * @param privateKey the private key provided by Braintree.
+ * The private key provided by Braintree.
*/
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
-
/**
* Helper method to get and Environment object from its name
- *
- * @return the environment
*/
private Environment getBraintreeEnvironment() {
String name = getEnvironment();
@@ -140,9 +121,7 @@ public class BraintreeConfiguration {
}
/**
- * Contruct a BraintreeGateway from configuration
- *
- * @return a braintree gateway
+ * Construct a BraintreeGateway from configuration
*/
BraintreeGateway newBraintreeGateway() {
return new BraintreeGateway(
@@ -152,15 +131,4 @@ public class BraintreeConfiguration {
getPrivateKey());
}
- /*
- public void validate() {
- if (ObjectHelper.isEmpty(environment)
- || ObjectHelper.isEmpty(merchantId)
- || ObjectHelper.isEmpty(publicKey)
- || ObjectHelper.isEmpty(privateKey)) {
- throw new IllegalArgumentException(String.format(
- "Missing required properties %s, %s, %s, %s", ENVIRONMENT, MERCHANT_ID, PUBLIC_KEY, PRIVATE_KEY));
- }
- }
- */
}
http://git-wip-us.apache.org/repos/asf/camel/blob/1962c830/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
index 25c83c4..b58224b 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
@@ -30,12 +30,13 @@ import org.apache.camel.component.braintree.internal.BraintreeConstants;
import org.apache.camel.component.braintree.internal.BraintreePropertiesHelper;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.component.AbstractApiEndpoint;
import org.apache.camel.util.component.ApiMethod;
import org.apache.camel.util.component.ApiMethodPropertiesHelper;
/**
- * Represents a Braintree endpoint.
+ * The braintree component is used for integrating with the Braintree Payment System.
*/
@UriEndpoint(scheme = "braintree", title = "Braintree", syntax = "braintree:name", consumerClass = BraintreeConsumer.class, label = "Braintree")
public class BraintreeEndpoint extends AbstractApiEndpoint<BraintreeApiName, BraintreeConfiguration> {
@@ -62,10 +63,9 @@ public class BraintreeEndpoint extends AbstractApiEndpoint<BraintreeApiName, Bra
@Override
public Consumer createConsumer(Processor processor) throws Exception {
// make sure inBody is not set for consumers
- if (inBody != null) {
- throw new IllegalArgumentException("Option inBody is not supported for consumer endpoint");
- }
- final BraintreeConsumer consumer = new BraintreeConsumer(this, processor);
+ ObjectHelper.notNull(inBody, "inbody", this);
+
+ BraintreeConsumer consumer = new BraintreeConsumer(this, processor);
// also set consumer.* properties
configureConsumer(consumer);
return consumer;
http://git-wip-us.apache.org/repos/asf/camel/blob/1962c830/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeProducer.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeProducer.java
index 3db8795..ee86492 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeProducer.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeProducer.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.braintree;
-
import org.apache.camel.component.braintree.internal.BraintreeApiName;
import org.apache.camel.component.braintree.internal.BraintreePropertiesHelper;
import org.apache.camel.util.component.AbstractApiProducer;
@@ -25,6 +24,7 @@ import org.apache.camel.util.component.AbstractApiProducer;
* The Braintree producer.
*/
public class BraintreeProducer extends AbstractApiProducer<BraintreeApiName, BraintreeConfiguration> {
+
public BraintreeProducer(BraintreeEndpoint endpoint) {
super(endpoint, BraintreePropertiesHelper.getHelper());
}