Skip to content
This repository has been archived by the owner on Nov 27, 2017. It is now read-only.

Adding the sql-stored-connector #58

Merged
merged 1 commit into from Sep 12, 2017

Conversation

KurtStam
Copy link
Contributor

@KurtStam KurtStam commented Sep 8, 2017

Adding the connector which includes the VerifierExtension as well as the MetaDataExtension. The MetaDataExtension will need to go through another iteration to adhere to the latest conventions.

Copy link
Member

@zregvart zregvart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some of the comments can be addressed in future PRs. Nothing that's really blocking this from getting merged.
One thing that we might want to do is to have a connector per database and use this one as a base for those. Not sure that citizen user will be interested in specifying driver class names. So having [oracle|postgresql|derby]-stored-procedure-connector that just extends from this might be better. That could open up bundling of Oracle driver as an option (as we would not be distributing it).

@@ -18,10 +18,10 @@
},
"componentProperties": {
"loginUrl": { "kind": "property", "displayName": "Login Url", "group": "security", "label": "common,security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "https://login.salesforce.com", "description": "URL of the Salesforce instance by default set to https://login.salesforce.com" },
"clientId": { "kind": "property", "displayName": "Client Id", "group": "security", "label": "common,security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "OAuth Consumer Key of the connected app configured in the Salesforce instance setup. Typically a connected app needs to be configured but one can be provided by installing a package." },
"clientId": { "kind": "property", "displayName": "Client Id", "group": "security", "label": "common,security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "description": "OAuth Consumer Key of the connected app configured in the Salesforce instance setup. Typically a connected app needs to be configured but one can be provided by installing a package." },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we wanted clientId to be non-secret see #55

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm the only reason that would change is bc I ran the build. I'm working in the sql-stored-connector

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw this too with newer version of Camel, I guess the camel-maven-package/connector plugins might generate code differently between versions; and quite possibly that I've changed that from true to false by hand. I would keep it out of this PR if possible and regenerate in the next PR (I'll create one for upgrading Camel version).

"clientSecret": { "kind": "property", "displayName": "Client Secret", "group": "security", "label": "common,security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "description": "OAuth Consumer Secret of the connected app configured in the Salesforce instance setup." },
"refreshToken": { "kind": "property", "displayName": "Refresh Token", "group": "security", "label": "common,security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "description": "Refresh token already obtained in the refresh token OAuth flow. One needs to setup a web application and configure a callback URL to receive the refresh token or configure using the builtin callback at https://login.salesforce.com/services/oauth2/success or https://test.salesforce.com/services/oauth2/success and then retrive the refresh_token from the URL at the end of the flow. Note that in development organizations Salesforce allows hosting the callback web application at localhost." },
"userName": { "kind": "property", "displayName": "User Name", "group": "security", "label": "common,security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Username used in OAuth flow to gain access to access token. It's easy to get started with password OAuth flow but in general one should avoid it as it is deemed less secure than other flows." },
"userName": { "kind": "property", "displayName": "User Name", "group": "security", "label": "common,security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "description": "Username used in OAuth flow to gain access to access token. It's easy to get started with password OAuth flow but in general one should avoid it as it is deemed less secure than other flows." },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the userName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm the only reason that would change is bc I ran the build. I'm working in the sql-stored-connector

<!-- camel and spring boot compiler plugins -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>apt</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we want apt to be in compile scope (perhaps provided or optional) or have them explicitly configured in the maven-compiler-plugin configuration see https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#annotationProcessorPaths

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zregvart We seem to be doing this on all connectors, so we should probably address that across all connectors. Shall I open a Jira just for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it would benefit to have this in the parent POM also

</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same about annotation processing as above

<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should also use https://github.com/basepom/basepom for connectors, or perhaps have a connectors-parent POM (no need to change in this PR), so some of these encodings (and others that we forget) are set beforehand


Connection connection = null;
ResultSet columnSet = null;
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto for try-with-resources

Class.forName(parameters.get("driver").toString());
} catch (Exception e) {
Enumeration<Driver> drivers = DriverManager.getDrivers();
StringBuffer supportedDrivers = new StringBuffer("[");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps use StringJoiner? Something like:

Collections.list(DriverManager.getDrivers())
  .stream()
  .map(Class::getName)
  .collect(Collectors.joining(", ", "[", "]"));

parameters.get("user").toString(),
parameters.get("password").toString());

if (connection == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this can happen according to the docs it should not return null.


private void verifyCredentials(ResultBuilder builder, Map<String, Object> parameters) {
try {
Class.forName(parameters.get("driver").toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should support non JDBC 4.0 drivers. With JDBC 4.0 this is no longer necessary. DriverManager will try to locate an appropriate driver via ServiceLoader, see the docs.

<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<mainClass>io.syndesis.example.TwitterPingCheckMain</mainClass>
Copy link
Member

@zregvart zregvart Sep 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, should be SqlStoredPingCheckMain?

@KurtStam
Copy link
Contributor Author

KurtStam commented Sep 12, 2017

@zregvart I think your comments on the pom above should be addressed in a separate issue as this applies to all the connectors. #62

Copy link
Member

@zregvart zregvart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pure-bot
Copy link

pure-bot bot commented Sep 12, 2017

Pull request approved by @zregvart - applying approved label

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants