You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/07/21 15:37:32 UTC

[GitHub] [camel] zbendhiba opened a new pull request #4028: camel-arangodb: add components configuration

zbendhiba opened a new pull request #4028:
URL: https://github.com/apache/camel/pull/4028


   [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful subject line and body.
   [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/master/CONTRIBUTING.md


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458198828



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.component.arangodb;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class ArangoDbConfiguration implements Cloneable {
+    private String database;
+    @UriParam
+    private String host;

Review comment:
       I'd assume at least host and port are required, then I think it makes sense to add `required` metadata to any required fields. 

##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.component.arangodb;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class ArangoDbConfiguration implements Cloneable {
+    private String database;
+    @UriParam
+    private String host;
+    @UriParam
+    private int port;
+    @UriParam(label = "security", secret = true)
+    private String user;
+    @UriParam(label = "security", secret = true)
+    private String password;
+    @UriParam

Review comment:
       Also label here are missing for the configurations, e.g: `producer`, `consumer` or `common` .. etc 

##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
##########
@@ -18,15 +18,44 @@
 
 import java.util.Map;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 
-@org.apache.camel.spi.annotations.Component("arangodb")
+@Component("arangodb")
 public class ArangoDbComponent extends DefaultComponent {
 
+    @Metadata
+    private ArangoDbConfiguration configuration = new ArangoDbConfiguration();
+
+    public ArangoDbComponent() {
+        this(null);
+    }
+
+    public ArangoDbComponent(CamelContext context) {
+        super(context);
+    }
+
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        Endpoint endpoint = new ArangoDbEndpoint(uri, this);
+        final ArangoDbConfiguration configuration = this.configuration != null ? this.configuration.copy() : new ArangoDbConfiguration();
+        configuration.setDatabase(remaining);

Review comment:
       Perhaps before setting the `database`, it would make sense to check its validity (e.g: is not empty) 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] zbendhiba commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458667016



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.component.arangodb;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class ArangoDbConfiguration implements Cloneable {
+    private String database;
+    @UriParam
+    private String host;
+    @UriParam
+    private int port;
+    @UriParam(label = "security", secret = true)
+    private String user;
+    @UriParam(label = "security", secret = true)
+    private String password;
+    @UriParam

Review comment:
       yes , done !!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458615972



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.component.arangodb;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class ArangoDbConfiguration implements Cloneable {
+    private String database;
+    @UriParam
+    private String host;

Review comment:
       ah then is all fine




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] oscerd merged pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
oscerd merged pull request #4028:
URL: https://github.com/apache/camel/pull/4028


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] zbendhiba commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458667567



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
##########
@@ -18,15 +18,44 @@
 
 import java.util.Map;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 
-@org.apache.camel.spi.annotations.Component("arangodb")
+@Component("arangodb")
 public class ArangoDbComponent extends DefaultComponent {
 
+    @Metadata
+    private ArangoDbConfiguration configuration = new ArangoDbConfiguration();
+
+    public ArangoDbComponent() {
+        this(null);
+    }
+
+    public ArangoDbComponent(CamelContext context) {
+        super(context);
+    }
+
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        Endpoint endpoint = new ArangoDbEndpoint(uri, this);
+        final ArangoDbConfiguration configuration = this.configuration != null ? this.configuration.copy() : new ArangoDbConfiguration();
+        configuration.setDatabase(remaining);

Review comment:
       we do need database name at minimum for any operation




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] zbendhiba commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458210724



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.component.arangodb;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class ArangoDbConfiguration implements Cloneable {
+    private String database;
+    @UriParam
+    private String host;

Review comment:
       I didn't make them required actually. Since the arangoDb driver has default values if no host/port indicated (same for user/password)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] omarsmak commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
omarsmak commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458617164



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
##########
@@ -18,15 +18,44 @@
 
 import java.util.Map;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 
-@org.apache.camel.spi.annotations.Component("arangodb")
+@Component("arangodb")
 public class ArangoDbComponent extends DefaultComponent {
 
+    @Metadata
+    private ArangoDbConfiguration configuration = new ArangoDbConfiguration();
+
+    public ArangoDbComponent() {
+        this(null);
+    }
+
+    public ArangoDbComponent(CamelContext context) {
+        super(context);
+    }
+
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
-        Endpoint endpoint = new ArangoDbEndpoint(uri, this);
+        final ArangoDbConfiguration configuration = this.configuration != null ? this.configuration.copy() : new ArangoDbConfiguration();
+        configuration.setDatabase(remaining);

Review comment:
       since arango driver has default values, I don't see the need for the check here




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] oscerd commented on a change in pull request #4028: camel-arangodb: add components configuration

Posted by GitBox <gi...@apache.org>.
oscerd commented on a change in pull request #4028:
URL: https://github.com/apache/camel/pull/4028#discussion_r458654064



##########
File path: components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.component.arangodb;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@UriParams
+public class ArangoDbConfiguration implements Cloneable {
+    private String database;
+    @UriParam
+    private String host;
+    @UriParam
+    private int port;
+    @UriParam(label = "security", secret = true)
+    private String user;
+    @UriParam(label = "security", secret = true)
+    private String password;
+    @UriParam

Review comment:
       @zbendhiba can you please add labels here?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org