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 2015/06/19 17:32:36 UTC

[1/9] camel git commit: Add goal to mvn plugin to validate if component docs is present when building each component.

Repository: camel
Updated Branches:
  refs/heads/master 5e08a9e8e -> de5c7b297


Add goal to mvn plugin to validate if component docs is present when building each component.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/824c35da
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/824c35da
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/824c35da

Branch: refs/heads/master
Commit: 824c35dac71cd2369e30d47d1ee45c87117b9ba8
Parents: 8c0039b
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 16:28:47 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:08 2015 +0200

----------------------------------------------------------------------
 camel-core/pom.xml                                           | 8 ++++++++
 components/pom.xml                                           | 5 +----
 .../apache/camel/maven/packaging/ValidateComponentMojo.java  | 2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/824c35da/camel-core/pom.xml
----------------------------------------------------------------------
diff --git a/camel-core/pom.xml b/camel-core/pom.xml
index ee871a4..66255a7 100644
--- a/camel-core/pom.xml
+++ b/camel-core/pom.xml
@@ -311,6 +311,14 @@
             </goals>
             <phase>process-classes</phase>
           </execution>
+          <!-- camel-core needs to validate before packaging -->
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+         </execution>
         </executions>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/camel/blob/824c35da/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 057fd60..0a6c3b5 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -31,7 +31,7 @@
   <packaging>pom</packaging>
 
   <modules>
-	  <!-- we want to test these modules first to catch any errors early as possible -->
+    <!-- we want to test these modules first to catch any errors early as possible -->
     <module>camel-test</module>
     <module>camel-testng</module>
     <module>camel-test-blueprint</module>
@@ -246,9 +246,6 @@
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-package-maven-plugin</artifactId>
         <version>${project.version}</version>
-        <configuration>
-          <validate>true</validate>
-        </configuration>
         <executions>
           <execution>
             <id>prepare</id>

http://git-wip-us.apache.org/repos/asf/camel/blob/824c35da/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
index 79b30ab..e1fa228 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
@@ -56,7 +56,7 @@ public class ValidateComponentMojo extends AbstractMojo {
     /**
      * Whether to validate if the components, data formats, and languages are properly documented and have all the needed details.
      *
-     * @parameter default-value="false"
+     * @parameter default-value="true"
      */
     protected Boolean validate;
 


[4/9] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/969a5f71
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/969a5f71
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/969a5f71

Branch: refs/heads/master
Commit: 969a5f71e70cc36b5eccc8c8c262c8585f6b35b5
Parents: 8dac850
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 17:18:27 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:09 2015 +0200

----------------------------------------------------------------------
 .../component/olingo2/Olingo2Component.java     |  8 ++++
 .../component/olingo2/Olingo2Configuration.java | 42 +++++++++++++-------
 .../component/olingo2/Olingo2Endpoint.java      |  2 +-
 3 files changed, 37 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/969a5f71/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
index dbbdd95..23863ec 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
@@ -91,6 +91,14 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling
         return new Olingo2Endpoint(uri, this, apiName, methodName, endpointConfiguration);
     }
 
+    /**
+     * To use the shared configuration
+     */
+    @Override
+    public void setConfiguration(Olingo2Configuration configuration) {
+        super.setConfiguration(configuration);
+    }
+
     public Olingo2AppWrapper createApiProxy(Olingo2Configuration endpointConfiguration) {
         final Olingo2AppWrapper result;
         if (endpointConfiguration.equals(this.configuration)) {

http://git-wip-us.apache.org/repos/asf/camel/blob/969a5f71/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
index d00b808..e383941 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
@@ -41,33 +41,22 @@ public class Olingo2Configuration {
     @UriPath
     @Metadata(required = "true")
     private Olingo2ApiName apiName;
-
     @UriPath @Metadata(required = "true")
     private String methodName;
-
     @UriParam
     private String serviceUri;
-
-    @UriParam
+    @UriParam(defaultValue = "application/json;charset=utf-8")
     private String contentType = DEFAULT_CONTENT_TYPE;
-
     @UriParam
     private Map<String, String> httpHeaders;
-
-    // common connection parameters for convenience
-    @UriParam
+    @UriParam(defaultValue = "" + DEFAULT_TIMEOUT)
     private int connectTimeout = DEFAULT_TIMEOUT;
-
-    @UriParam
+    @UriParam(defaultValue = "" + DEFAULT_TIMEOUT)
     private int socketTimeout = DEFAULT_TIMEOUT;
-
     @UriParam
     private HttpHost proxy;
-
     @UriParam
     private SSLContextParameters sslContextParameters;
-
-    // for more complex configuration, use a client builder
     @UriParam
     private HttpAsyncClientBuilder httpAsyncClientBuilder;
 
@@ -97,6 +86,9 @@ public class Olingo2Configuration {
         return serviceUri;
     }
 
+    /**
+     * Target OData service base URI, e.g. http://services.odata.org/OData/OData.svc
+     */
     public void setServiceUri(String serviceUri) {
         this.serviceUri = serviceUri;
     }
@@ -105,6 +97,9 @@ public class Olingo2Configuration {
         return contentType;
     }
 
+    /**
+     * Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8
+     */
     public void setContentType(String contentType) {
         this.contentType = contentType;
     }
@@ -113,6 +108,9 @@ public class Olingo2Configuration {
         return httpHeaders;
     }
 
+    /**
+     * Custom HTTP headers to inject into every request, this could include OAuth tokens, etc.
+     */
     public void setHttpHeaders(Map<String, String> httpHeaders) {
         this.httpHeaders = httpHeaders;
     }
@@ -121,6 +119,9 @@ public class Olingo2Configuration {
         return connectTimeout;
     }
 
+    /**
+     * HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds)
+     */
     public void setConnectTimeout(int connectTimeout) {
         this.connectTimeout = connectTimeout;
     }
@@ -129,6 +130,9 @@ public class Olingo2Configuration {
         return socketTimeout;
     }
 
+    /**
+     * HTTP request timeout in milliseconds, defaults to 30,000 (30 seconds)
+     */
     public void setSocketTimeout(int socketTimeout) {
         this.socketTimeout = socketTimeout;
     }
@@ -137,6 +141,9 @@ public class Olingo2Configuration {
         return proxy;
     }
 
+    /**
+     * HTTP proxy server configuration
+     */
     public void setProxy(HttpHost proxy) {
         this.proxy = proxy;
     }
@@ -145,6 +152,9 @@ public class Olingo2Configuration {
         return sslContextParameters;
     }
 
+    /**
+     * To configure security using SSLContextParameters
+     */
     public void setSslContextParameters(SSLContextParameters sslContextParameters) {
         this.sslContextParameters = sslContextParameters;
     }
@@ -153,6 +163,10 @@ public class Olingo2Configuration {
         return httpAsyncClientBuilder;
     }
 
+    /**
+     * Custom HTTP async client builder for more complex HTTP client configuration, overrides connectionTimeout, socketTimeout, proxy and sslContext.
+     * Note that a socketTimeout MUST be specified in the builder, otherwise OData requests could block indefinitely
+     */
     public void setHttpAsyncClientBuilder(HttpAsyncClientBuilder httpAsyncClientBuilder) {
         this.httpAsyncClientBuilder = httpAsyncClientBuilder;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/969a5f71/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
index dee0768..d8a2065 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
@@ -38,7 +38,7 @@ import org.apache.camel.util.component.ApiMethodPropertiesHelper;
 /**
  * Represents a Olingo2 endpoint.
  */
-@UriEndpoint(scheme = "olingo2", title = "Olingo2", syntax = "olingo2:apiName/methodName", consumerClass = Olingo2Consumer.class, consumerPrefix = "consumer")
+@UriEndpoint(scheme = "olingo2", title = "Olingo2", syntax = "olingo2:apiName/methodName", consumerClass = Olingo2Consumer.class, label = "cloud")
 public class Olingo2Endpoint extends AbstractApiEndpoint<Olingo2ApiName, Olingo2Configuration> {
 
     protected static final String RESOURCE_PATH_PROPERTY = "resourcePath";


[5/9] camel git commit: Add goal to mvn plugin to validate if component docs is present when building each component.

Posted by da...@apache.org.
Add goal to mvn plugin to validate if component docs is present when building each component.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/23ebf593
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/23ebf593
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/23ebf593

Branch: refs/heads/master
Commit: 23ebf593949d01a5172707dfb8abe310985b42ae
Parents: 824c35d
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 16:46:07 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:09 2015 +0200

----------------------------------------------------------------------
 .../main/resources/archetype-resources/pom.xml  | 23 ++++++++++++++++++++
 .../src/main/java/__name__Endpoint.java         |  8 ++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/23ebf593/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
index eae7042..702210a 100644
--- a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
@@ -98,6 +98,29 @@
         </configuration>
       </plugin>
 
+      <!-- generate components meta-data and validate component includes documentation etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${camel-version}</version>
+        <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>
+
       <!-- to generate the MANIFEST-FILE of the bundle -->
       <plugin>
         <groupId>org.apache.felix</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/23ebf593/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Endpoint.java
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Endpoint.java b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Endpoint.java
index 1f97a1e..2520197 100644
--- a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Endpoint.java
+++ b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/java/__name__Endpoint.java
@@ -28,7 +28,7 @@ import org.apache.camel.spi.UriPath;
 /**
  * Represents a ${name} endpoint.
  */
-@UriEndpoint(scheme = "${scheme}", title = "${name}" syntax="${scheme}:name", consumerClass = ${name}Consumer.class, label = "${name}")
+@UriEndpoint(scheme = "${scheme}", title = "${name}", syntax="${scheme}:name", consumerClass = ${name}Consumer.class, label = "${name}")
 public class ${name}Endpoint extends DefaultEndpoint {
     @UriPath @Metadata(required = "true")
     private String name;
@@ -58,6 +58,9 @@ public class ${name}Endpoint extends DefaultEndpoint {
         return true;
     }
 
+    /**
+     * Some description of this option, and what it does
+     */
     public void setName(String name) {
         this.name = name;
     }
@@ -66,6 +69,9 @@ public class ${name}Endpoint extends DefaultEndpoint {
         return name;
     }
 
+    /**
+     * Some description of this option, and what it does
+     */
     public void setOption(int option) {
         this.option = option;
     }


[6/9] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1499d489
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1499d489
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1499d489

Branch: refs/heads/master
Commit: 1499d4891a80e4dc7e74dde2519aa69ee9505541
Parents: 23ebf59
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 16:51:08 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:09 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/ejb/EjbComponent.java  | 14 +++++++-------
 .../component/ejb/GreaterCamelEjbPropertiesTest.java  |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1499d489/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
index 91ac608..29d27a8 100644
--- a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
+++ b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
@@ -36,7 +36,7 @@ import org.apache.camel.spi.Registry;
 public class EjbComponent extends BeanComponent {
 
     private Context context;
-    private Properties properties;
+    private Properties jndiProperties;
 
     public EjbComponent() {
         super(EjbEndpoint.class);
@@ -67,23 +67,23 @@ public class EjbComponent extends BeanComponent {
         this.context = context;
     }
 
-    public Properties getProperties() {
-        return properties;
+    public Properties getJndiProperties() {
+        return jndiProperties;
     }
 
     /**
      * Properties for creating javax.naming.Context if a context has not been configured.
      */
-    public void setProperties(Properties properties) {
-        this.properties = properties;
+    public void setJndiProperties(Properties jndiProperties) {
+        this.jndiProperties = jndiProperties;
     }
 
     @Override
     protected void doStart() throws Exception {
         super.doStart();
 
-        if (context == null && properties != null) {
-            context = new InitialContext(getProperties());
+        if (context == null && jndiProperties != null) {
+            context = new InitialContext(getJndiProperties());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1499d489/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
index 14e921d..2007ad1 100644
--- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
+++ b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
@@ -41,7 +41,7 @@ public class GreaterCamelEjbPropertiesTest extends CamelTestSupport {
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
 
         EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class);
-        ejb.setProperties(properties);
+        ejb.setJndiProperties(properties);
 
         return answer;
     }


[3/9] camel git commit: Add goal to mvn plugin to validate if component docs is present when building each component.

Posted by da...@apache.org.
Add goal to mvn plugin to validate if component docs is present when building each component.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/572f9e23
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/572f9e23
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/572f9e23

Branch: refs/heads/master
Commit: 572f9e230f6f9317976f0e848f1e87122110e720
Parents: 5e08a9e
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 16:12:30 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:08 2015 +0200

----------------------------------------------------------------------
 components/pom.xml                              |  13 +-
 .../camel/maven/packaging/ErrorDetail.java      |  93 +++++++++++++
 .../maven/packaging/PrepareCatalogMojo.java     |   7 +
 .../camel/maven/packaging/StringHelper.java     |  15 ++
 .../maven/packaging/ValidateComponentMojo.java  | 139 +++++++++++++++++++
 .../camel/maven/packaging/ValidateHelper.java   | 138 ++++++++++++++++++
 6 files changed, 404 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/572f9e23/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index c6fa5ba..057fd60 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -246,13 +246,24 @@
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-package-maven-plugin</artifactId>
         <version>${project.version}</version>
+        <configuration>
+          <validate>true</validate>
+        </configuration>
         <executions>
           <execution>
+            <id>prepare</id>
             <goals>
               <goal>prepare-components</goal>
             </goals>
             <phase>generate-resources</phase>
-          </execution>
+         </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+         </execution>
         </executions>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/camel/blob/572f9e23/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ErrorDetail.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ErrorDetail.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ErrorDetail.java
new file mode 100644
index 0000000..3266a58
--- /dev/null
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ErrorDetail.java
@@ -0,0 +1,93 @@
+/**
+ * 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.maven.packaging;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class ErrorDetail {
+
+    private String kind;
+
+    private boolean missingLabel;
+    private boolean missingDescription;
+    private boolean missingSyntax;
+    private boolean missingUriPath;
+    private List<String> missingComponentDocumentation = new ArrayList<>();
+    private List<String> missingEndpointDocumentation = new ArrayList<>();
+
+    public boolean hasErrors() {
+        return missingLabel || missingDescription || missingDescription || missingUriPath || !missingComponentDocumentation.isEmpty() || !missingEndpointDocumentation.isEmpty();
+    }
+
+    public String getKind() {
+        return kind;
+    }
+
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+
+    public boolean isMissingUriPath() {
+        return missingUriPath;
+    }
+
+    public void setMissingUriPath(boolean missingUriPath) {
+        this.missingUriPath = missingUriPath;
+    }
+
+    public boolean isMissingLabel() {
+        return missingLabel;
+    }
+
+    public void setMissingLabel(boolean missingLabel) {
+        this.missingLabel = missingLabel;
+    }
+
+    public boolean isMissingDescription() {
+        return missingDescription;
+    }
+
+    public void setMissingDescription(boolean missingDescription) {
+        this.missingDescription = missingDescription;
+    }
+
+    public boolean isMissingSyntax() {
+        return missingSyntax;
+    }
+
+    public void setMissingSyntax(boolean missingSyntax) {
+        this.missingSyntax = missingSyntax;
+    }
+
+    public void addMissingComponentDoc(String option) {
+        missingComponentDocumentation.add(option);
+    }
+
+    public void addMissingEndpointDoc(String option) {
+        missingEndpointDocumentation.add(option);
+    }
+
+    public List<String> getMissingComponentDocumentation() {
+        return missingComponentDocumentation;
+    }
+
+    public List<String> getMissingEndpointDocumentation() {
+        return missingEndpointDocumentation;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/572f9e23/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
index f0563bf..8405781 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
@@ -62,6 +62,13 @@ public class PrepareCatalogMojo extends AbstractMojo {
     protected MavenProject project;
 
     /**
+     * Whether to validate if the components, data formats, and languages are properly documented and have all the needed details.
+     *
+     * @parameter default-value="true"
+     */
+    protected Boolean validate;
+
+    /**
      * The output directory for components catalog
      *
      * @parameter default-value="${project.build.directory}/classes/org/apache/camel/catalog/components"

http://git-wip-us.apache.org/repos/asf/camel/blob/572f9e23/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/StringHelper.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/StringHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/StringHelper.java
index ac6a133..e17f430 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/StringHelper.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/StringHelper.java
@@ -16,11 +16,18 @@
  */
 package org.apache.camel.maven.packaging;
 
+import java.util.Collection;
+
 public final class StringHelper {
+
     private StringHelper() {
         // Utils Class
     }
 
+    public static boolean isEmpty(String s) {
+        return s == null || s.trim().isEmpty();
+    }
+
     public static String after(String text, String after) {
         if (!text.contains(after)) {
             return null;
@@ -43,4 +50,12 @@ public final class StringHelper {
         return before(text, before);
     }
 
+    public static String indentCollection(String indent, Collection<String> list) {
+        StringBuilder sb = new StringBuilder();
+        for (String text : list) {
+            sb.append(indent).append(text);
+        }
+        return sb.toString();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/572f9e23/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
new file mode 100644
index 0000000..58b3b11
--- /dev/null
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
@@ -0,0 +1,139 @@
+/**
+ * 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.maven.packaging;
+
+import java.io.File;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+import static org.apache.camel.maven.packaging.StringHelper.indentCollection;
+import static org.apache.camel.maven.packaging.ValidateHelper.asName;
+import static org.apache.camel.maven.packaging.ValidateHelper.validate;
+
+/**
+ * Validate a Camel component analyzing if the meta-data files for
+ * <ul>
+ *     <li>components</li>
+ *     <li>dataformats</li>
+ *     <li>languages</li>
+ * </ul>
+ * all contains the needed meta-data such as assigned labels, documentation for each option
+ *
+ * @goal validate-components
+ */
+public class ValidateComponentMojo extends AbstractMojo {
+
+    /**
+     * The maven project.
+     *
+     * @parameter property="project"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+    /**
+     * Whether to validate if the components, data formats, and languages are properly documented and have all the needed details.
+     *
+     * @parameter default-value="false"
+     */
+    protected Boolean validate;
+
+    /**
+     * The output directory for generated components file
+     *
+     * @parameter default-value="${project.build.directory}/classes/"
+     */
+    protected File outDir;
+
+    /**
+     * Maven ProjectHelper.
+     *
+     * @component
+     * @readonly
+     */
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * build context to check changed files and mark them for refresh
+     * (used for m2e compatibility)
+     *
+     * @component
+     * @readonly
+     */
+    private BuildContext buildContext;
+    
+    /**
+     * Execute goal.
+     *
+     * @throws org.apache.maven.plugin.MojoExecutionException execution of the main class or one of the
+     *                                                        threads it generated failed.
+     * @throws org.apache.maven.plugin.MojoFailureException   something bad happened...
+     */
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        final Set<File> jsonFiles = new TreeSet<>();
+        PackageHelper.findJsonFiles(outDir, jsonFiles, new PackageHelper.CamelComponentsModelFilter());
+
+        boolean failed = false;
+        if (validate) {
+            getLog().info("Validating ...");
+
+            for (File file : jsonFiles) {
+                final String name = asName(file);
+                final ErrorDetail detail = new ErrorDetail();
+
+                validate(file, detail);
+
+                if (detail.hasErrors()) {
+                    failed = true;
+                    getLog().warn("The " + detail.getKind() + ": " + name + " has errors!");
+                    if (detail.isMissingDescription()) {
+                        getLog().warn("Missing description on " + detail.getKind());
+                    }
+                    if (detail.isMissingLabel()) {
+                        getLog().warn("Missing label on " + detail.getKind());
+                    }
+                    if (detail.isMissingSyntax()) {
+                        getLog().warn("Missing syntax on endpoint");
+                    }
+                    if (detail.isMissingUriPath()) {
+                        getLog().warn("Missing @UriPath on endpoint");
+                    }
+                    if (!detail.getMissingComponentDocumentation().isEmpty()) {
+                        getLog().warn("Missing component documentation for the following options:" + indentCollection("\n\t", detail.getMissingComponentDocumentation()));
+                    }
+                    if (!detail.getMissingEndpointDocumentation().isEmpty()) {
+                        getLog().warn("Missing endpoint documentation for the following options:" + indentCollection("\n\t", detail.getMissingEndpointDocumentation()));
+                    }
+                }
+            }
+        }
+
+        if (failed) {
+            throw new MojoFailureException("There are validation errors, see above!");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/572f9e23/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
new file mode 100644
index 0000000..4db0e73
--- /dev/null
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
@@ -0,0 +1,138 @@
+/**
+ * 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.maven.packaging;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.camel.maven.packaging.PackageHelper.loadText;
+
+/**
+ * Validation helper for validating components, data formats and languages
+ */
+public final class ValidateHelper {
+
+    private ValidateHelper() {
+    }
+
+    /**
+     * Validates the component json file
+     *
+     * @param file        the json file
+     * @param errorDetail details to add errors
+     */
+    public static void validate(File file, ErrorDetail errorDetail) {
+        String name = asName(file);
+
+        try {
+            String json = loadText(new FileInputStream(file));
+
+            boolean isComponent = json.contains("\"kind\": \"component\"");
+            boolean isDataFormat = json.contains("\"kind\": \"dataformat\"");
+            boolean isLanguage = json.contains("\"kind\": \"language\"");
+
+            // only check these kind
+            if (!isComponent && !isDataFormat && !isLanguage) {
+                return;
+            }
+
+            if (isComponent) {
+                errorDetail.setKind("component");
+            } else if (isDataFormat) {
+                errorDetail.setKind("dataformat");
+            } else if (isLanguage) {
+                errorDetail.setKind("language");
+            }
+
+            List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema(errorDetail.getKind(), json, false);
+            boolean label = false;
+            boolean description = false;
+            boolean syntax = false;
+            for (Map<String, String> row : rows) {
+                String value = row.get("label");
+                if (!StringHelper.isEmpty(value)) {
+                    label = true;
+                }
+                value = row.get("description");
+                if (!StringHelper.isEmpty(value)) {
+                    description = true;
+                }
+                value = row.get("syntax");
+                if (!StringHelper.isEmpty(value)) {
+                    syntax = true;
+                }
+            }
+            if (!label) {
+                errorDetail.setMissingLabel(true);
+            }
+            if (!description) {
+                errorDetail.setMissingDescription(true);
+            }
+            if (!syntax) {
+                errorDetail.setMissingDescription(true);
+            }
+
+            if (isComponent) {
+                // check all the component properties if they have description
+                rows = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true);
+                for (Map<String, String> row : rows) {
+                    String key = row.get("name");
+                    String doc = row.get("description");
+                    if (doc == null || doc.isEmpty()) {
+                        errorDetail.addMissingComponentDoc(key);
+                    }
+                }
+            }
+
+            // check all the endpoint properties if they have description
+            rows = JSonSchemaHelper.parseJsonSchema("properties", json, true);
+            boolean path = false;
+            for (Map<String, String> row : rows) {
+                String key = row.get("name");
+                String doc = row.get("description");
+                if (doc == null || doc.isEmpty()) {
+                    errorDetail.addMissingEndpointDoc(key);
+                }
+                String kind = row.get("kind");
+                if ("path".equals(kind)) {
+                    path = true;
+                }
+            }
+            if (isComponent && !path) {
+                // only components can have missing @UriPath
+                errorDetail.setMissingUriPath(true);
+            }
+        } catch (IOException e) {
+            // ignore
+        }
+    }
+
+    /**
+     * Returns the name of the component, data format or language from the given json file
+     */
+    public static String asName(File file) {
+        String name = file.getName();
+        if (name.endsWith(".json")) {
+            return name.substring(0, name.length() - 5);
+        }
+        return name;
+    }
+
+}


[7/9] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8dac8509
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8dac8509
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8dac8509

Branch: refs/heads/master
Commit: 8dac85090525677913fa8f2568b3a517208ee7ae
Parents: 1499d48
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 17:10:06 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:09 2015 +0200

----------------------------------------------------------------------
 .../component/olingo2/Olingo2Component.java     |  2 ++
 .../component/olingo2/Olingo2Configuration.java | 32 ++++++++++++++++++++
 .../component/olingo2/Olingo2Endpoint.java      |  6 ++++
 3 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8dac8509/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
index 2cbfd2b..dbbdd95 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
@@ -86,6 +86,8 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling
     @Override
     protected Endpoint createEndpoint(String uri, String methodName, Olingo2ApiName apiName,
                                       Olingo2Configuration endpointConfiguration) {
+        endpointConfiguration.setApiName(apiName);
+        endpointConfiguration.setMethodName(methodName);
         return new Olingo2Endpoint(uri, this, apiName, methodName, endpointConfiguration);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8dac8509/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
index 80e1bcf..d00b808 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
@@ -18,8 +18,11 @@ package org.apache.camel.component.olingo2;
 
 import java.util.Map;
 
+import org.apache.camel.component.olingo2.internal.Olingo2ApiName;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.jsse.SSLContextParameters;
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.http.HttpHost;
@@ -35,6 +38,13 @@ public class Olingo2Configuration {
     private static final String DEFAULT_CONTENT_TYPE = ContentType.APPLICATION_JSON.toString();
     private static final int DEFAULT_TIMEOUT = 30 * 1000;
 
+    @UriPath
+    @Metadata(required = "true")
+    private Olingo2ApiName apiName;
+
+    @UriPath @Metadata(required = "true")
+    private String methodName;
+
     @UriParam
     private String serviceUri;
 
@@ -61,6 +71,28 @@ public class Olingo2Configuration {
     @UriParam
     private HttpAsyncClientBuilder httpAsyncClientBuilder;
 
+    public Olingo2ApiName getApiName() {
+        return apiName;
+    }
+
+    /**
+     * What kind of operation to perform
+     */
+    public void setApiName(Olingo2ApiName apiName) {
+        this.apiName = apiName;
+    }
+
+    public String getMethodName() {
+        return methodName;
+    }
+
+    /**
+     * What sub operation to use for the selected operation
+     */
+    public void setMethodName(String methodName) {
+        this.methodName = methodName;
+    }
+
     public String getServiceUri() {
         return serviceUri;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/8dac8509/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
index 5400e72..dee0768 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java
@@ -30,6 +30,7 @@ import org.apache.camel.component.olingo2.internal.Olingo2ApiName;
 import org.apache.camel.component.olingo2.internal.Olingo2Constants;
 import org.apache.camel.component.olingo2.internal.Olingo2PropertiesHelper;
 import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.component.AbstractApiEndpoint;
 import org.apache.camel.util.component.ApiMethod;
 import org.apache.camel.util.component.ApiMethodPropertiesHelper;
@@ -53,12 +54,17 @@ public class Olingo2Endpoint extends AbstractApiEndpoint<Olingo2ApiName, Olingo2
 
     private final Set<String> endpointPropertyNames;
 
+    @UriParam
+    private Olingo2Configuration configuration;
+
     private Olingo2AppWrapper apiProxy;
 
     public Olingo2Endpoint(String uri, Olingo2Component component,
                            Olingo2ApiName apiName, String methodName, Olingo2Configuration endpointConfiguration) {
         super(uri, component, apiName, methodName, Olingo2ApiCollection.getCollection().getHelper(apiName), endpointConfiguration);
 
+        this.configuration = endpointConfiguration;
+
         // get all endpoint property names
         endpointPropertyNames = new HashSet<String>(getPropertiesHelper().getValidEndpointProperties(configuration));
         // avoid adding edm as queryParam


[2/9] camel git commit: Add goal to mvn plugin to validate if component docs is present when building each component.

Posted by da...@apache.org.
Add goal to mvn plugin to validate if component docs is present when building each component.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8c0039b3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8c0039b3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8c0039b3

Branch: refs/heads/master
Commit: 8c0039b3d7b93750586b7c2c099eda9b5ca7720d
Parents: 572f9e2
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 16:23:43 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:08 2015 +0200

----------------------------------------------------------------------
 components/camel-salesforce/pom.xml             | 30 ++++++++++++++++++++
 .../maven/packaging/PrepareCatalogMojo.java     |  2 ++
 .../maven/packaging/ValidateComponentMojo.java  | 26 ++++++++++-------
 .../camel/maven/packaging/ValidateHelper.java   |  4 +--
 4 files changed, 48 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/components/camel-salesforce/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/pom.xml b/components/camel-salesforce/pom.xml
index 61ccca7..b110ff0 100644
--- a/components/camel-salesforce/pom.xml
+++ b/components/camel-salesforce/pom.xml
@@ -35,6 +35,36 @@
         <module>camel-salesforce-maven-plugin</module>
     </modules>
 
+ <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <!-- TODO: remove all this when we have salesforce documented -->
+          <validate>false</validate>
+        </configuration>
+        <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>
+    </plugins>
+  </build>
+
     <profiles>
 
       <profile>

http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
index 8405781..169486b 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
@@ -169,6 +169,8 @@ public class PrepareCatalogMojo extends AbstractMojo {
         executeXmlSchemas();
     }
 
+    // TODO: Remove some of the missing check as we should have that out of the box with the validate goal
+
     protected void executeModel() throws MojoExecutionException, MojoFailureException {
         getLog().info("Copying all Camel model json descriptors");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
index 58b3b11..79b30ab 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateComponentMojo.java
@@ -93,27 +93,29 @@ public class ValidateComponentMojo extends AbstractMojo {
      */
     public void execute() throws MojoExecutionException, MojoFailureException {
 
-        final Set<File> jsonFiles = new TreeSet<>();
-        PackageHelper.findJsonFiles(outDir, jsonFiles, new PackageHelper.CamelComponentsModelFilter());
+        if (!validate) {
+            getLog().info("Validation disabled");
+        } else {
 
-        boolean failed = false;
-        if (validate) {
-            getLog().info("Validating ...");
+            final Set<File> jsonFiles = new TreeSet<File>();
+            PackageHelper.findJsonFiles(outDir, jsonFiles, new PackageHelper.CamelComponentsModelFilter());
+            boolean failed = false;
 
             for (File file : jsonFiles) {
                 final String name = asName(file);
                 final ErrorDetail detail = new ErrorDetail();
 
+                getLog().debug("Validating file " + file);
                 validate(file, detail);
 
                 if (detail.hasErrors()) {
                     failed = true;
-                    getLog().warn("The " + detail.getKind() + ": " + name + " has errors!");
+                    getLog().warn("The " + detail.getKind() + ": " + name + " has validation errors");
                     if (detail.isMissingDescription()) {
-                        getLog().warn("Missing description on " + detail.getKind());
+                        getLog().warn("Missing description on: " + detail.getKind());
                     }
                     if (detail.isMissingLabel()) {
-                        getLog().warn("Missing label on " + detail.getKind());
+                        getLog().warn("Missing label on: " + detail.getKind());
                     }
                     if (detail.isMissingSyntax()) {
                         getLog().warn("Missing syntax on endpoint");
@@ -129,10 +131,12 @@ public class ValidateComponentMojo extends AbstractMojo {
                     }
                 }
             }
-        }
 
-        if (failed) {
-            throw new MojoFailureException("There are validation errors, see above!");
+            if (failed) {
+                throw new MojoFailureException("Validating failed, see errors above!");
+            } else {
+                getLog().info("Validation complete");
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8c0039b3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
index 4db0e73..ac52996 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ValidateHelper.java
@@ -39,8 +39,6 @@ public final class ValidateHelper {
      * @param errorDetail details to add errors
      */
     public static void validate(File file, ErrorDetail errorDetail) {
-        String name = asName(file);
-
         try {
             String json = loadText(new FileInputStream(file));
 
@@ -86,7 +84,7 @@ public final class ValidateHelper {
                 errorDetail.setMissingDescription(true);
             }
             if (!syntax) {
-                errorDetail.setMissingDescription(true);
+                errorDetail.setMissingSyntax(true);
             }
 
             if (isComponent) {


[9/9] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/de5c7b29
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/de5c7b29
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/de5c7b29

Branch: refs/heads/master
Commit: de5c7b297166ee757e6a9c817e3c151ce9a1b3b7
Parents: 3b6631d
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 17:27:08 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:10 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/ejb/EjbComponent.java  | 14 +++++++-------
 .../component/ejb/GreaterCamelEjbPropertiesTest.java  |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/de5c7b29/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
index 29d27a8..91ac608 100644
--- a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
+++ b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java
@@ -36,7 +36,7 @@ import org.apache.camel.spi.Registry;
 public class EjbComponent extends BeanComponent {
 
     private Context context;
-    private Properties jndiProperties;
+    private Properties properties;
 
     public EjbComponent() {
         super(EjbEndpoint.class);
@@ -67,23 +67,23 @@ public class EjbComponent extends BeanComponent {
         this.context = context;
     }
 
-    public Properties getJndiProperties() {
-        return jndiProperties;
+    public Properties getProperties() {
+        return properties;
     }
 
     /**
      * Properties for creating javax.naming.Context if a context has not been configured.
      */
-    public void setJndiProperties(Properties jndiProperties) {
-        this.jndiProperties = jndiProperties;
+    public void setProperties(Properties properties) {
+        this.properties = properties;
     }
 
     @Override
     protected void doStart() throws Exception {
         super.doStart();
 
-        if (context == null && jndiProperties != null) {
-            context = new InitialContext(getJndiProperties());
+        if (context == null && properties != null) {
+            context = new InitialContext(getProperties());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/de5c7b29/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
index 2007ad1..14e921d 100644
--- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
+++ b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java
@@ -41,7 +41,7 @@ public class GreaterCamelEjbPropertiesTest extends CamelTestSupport {
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
 
         EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class);
-        ejb.setJndiProperties(properties);
+        ejb.setProperties(properties);
 
         return answer;
     }


[8/9] camel git commit: Fixed json parser for component docs

Posted by da...@apache.org.
Fixed json parser for component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3b6631d8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3b6631d8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3b6631d8

Branch: refs/heads/master
Commit: 3b6631d8673ea51f189dba52bf8d8944aae00f72
Parents: 969a5f7
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jun 19 17:26:40 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jun 19 17:38:10 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/util/JsonSchemaHelper.java     | 2 +-
 .../src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java  | 2 +-
 .../main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java    | 2 +-
 .../java/org/apache/camel/maven/packaging/JSonSchemaHelper.java   | 3 +--
 4 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3b6631d8/camel-core/src/main/java/org/apache/camel/util/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/JsonSchemaHelper.java b/camel-core/src/main/java/org/apache/camel/util/JsonSchemaHelper.java
index 3c48267..336bf85 100644
--- a/camel-core/src/main/java/org/apache/camel/util/JsonSchemaHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/JsonSchemaHelper.java
@@ -135,7 +135,7 @@ public final class JsonSchemaHelper {
             // we need to find the group first
             if (!found) {
                 String s = line.trim();
-                found = s.startsWith("\"" + group + "\":");
+                found = s.startsWith("\"" + group + "\":") && s.endsWith("{");
                 continue;
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/3b6631d8/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
index f9f628a..17e0f85 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
@@ -52,7 +52,7 @@ public final class JSonSchemaHelper {
             // we need to find the group first
             if (!found) {
                 String s = line.trim();
-                found = s.startsWith("\"" + group + "\":");
+                found = s.startsWith("\"" + group + "\":") && s.endsWith("{");
                 continue;
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/3b6631d8/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
index a67e2ca..0df1eb1 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
@@ -285,7 +285,7 @@ final class JsonSchemaHelper {
             // we need to find the group first
             if (!found) {
                 String s = line.trim();
-                found = s.startsWith("\"" + group + "\":");
+                found = s.startsWith("\"" + group + "\":") && s.endsWith("{");
                 continue;
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/3b6631d8/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/JSonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/JSonSchemaHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/JSonSchemaHelper.java
index 0d2c7f8..9b6732e 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/JSonSchemaHelper.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/JSonSchemaHelper.java
@@ -52,7 +52,7 @@ public final class JSonSchemaHelper {
             // we need to find the group first
             if (!found) {
                 String s = line.trim();
-                found = s.startsWith("\"" + group + "\":");
+                found = s.startsWith("\"" + group + "\":") && s.endsWith("{");
                 continue;
             }
 
@@ -112,5 +112,4 @@ public final class JSonSchemaHelper {
         return value;
     }
 
-
 }