This repository has been archived by the owner on Nov 27, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kurt t stam
committed
Sep 12, 2017
1 parent
a248266
commit 5344293
Showing
37 changed files
with
2,118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ target | |
.project | ||
.settings | ||
.classpath | ||
.factorypath | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
derby.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.syndesis</groupId> | ||
<artifactId>connectors</artifactId> | ||
<version>0.4-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>sql-stored-connector</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Syndesis Connectors :: Sql Stored Connector</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<camel.version>2.20.0.fuse-000091</camel.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!-- Camel BOM --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-parent</artifactId> | ||
<version>${camel.version}</version> | ||
<scope>import</scope> | ||
<type>pom</type> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
|
||
<!-- base component to use for this connector --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-sql</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-sql-starter</artifactId> | ||
</dependency> | ||
|
||
<!-- camel-connector --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-connector</artifactId> | ||
</dependency> | ||
|
||
<!-- camel and spring boot compiler plugins --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>apt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<version>${spring-boot.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-dbcp</groupId> | ||
<artifactId>commons-dbcp</artifactId> | ||
</dependency> | ||
|
||
<!-- supported drivers --> | ||
<dependency> | ||
<groupId>org.apache.derby</groupId> | ||
<artifactId>derby</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql</artifactId> | ||
</dependency> | ||
<!-- The Oracle Driver needs to be added manually by user, for licensing compliance | ||
it can not be shipped. We need to provide some mechnism so the integrator can upload | ||
this jar. (http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html) | ||
<dependency> | ||
<groupId>oracle</groupId> | ||
<artifactId>jdbc</artifactId> | ||
<version>12.0</version> | ||
<scope>system</scope> | ||
<systemPath>ojdbc8.jar</systemPath> | ||
</dependency> | ||
--> | ||
|
||
<!-- logging --> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j-impl</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- testing --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.module</groupId> | ||
<artifactId>jackson-module-jsonSchema</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<defaultGoal>install</defaultGoal> | ||
|
||
<plugins> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.1</version> | ||
<configuration> | ||
<encoding>UTF-8</encoding> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- generate components meta-data and validate component includes documentation etc | ||
Disabled until the plugin supports adding parameters at the connector level. At the moment | ||
they are added manually. | ||
<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> | ||
--> | ||
|
||
<!-- generate connector | ||
<plugin> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-connector-maven-plugin</artifactId> | ||
<version>${camel.version}</version> | ||
<executions> | ||
<execution> | ||
<id>boot</id> | ||
<goals> | ||
<goal>prepare-spring-boot-auto-configuration</goal> | ||
</goals> | ||
<configuration> | ||
<includeLicenseHeader>false</includeLicenseHeader> | ||
<configurationPrefix>false</configurationPrefix> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>connector</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
--> | ||
|
||
</plugins> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>jboss-ea</id> | ||
<name>JBoss Early-access repository</name> | ||
<url>https://repository.jboss.org/nexus/content/groups/ea/</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
|
||
</project> |
33 changes: 33 additions & 0 deletions
33
connectors/sql-stored-connector/src/main/java/io/syndesis/connector/ColumnMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* 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 io.syndesis.connector; | ||
|
||
/** | ||
* Complete Enumeration of Column modes in use by | ||
* Stored Procedures. | ||
* | ||
* @since 09/11/17 | ||
* @author kstam | ||
* | ||
*/ | ||
public enum ColumnMode { | ||
UNKNOWN, IN, INOUT, RESULT, OUT, RETURN; | ||
|
||
public static ColumnMode valueOf(int columnType) { | ||
return ColumnMode.values()[columnType]; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
connectors/sql-stored-connector/src/main/java/io/syndesis/connector/DatabaseProduct.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* 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 io.syndesis.connector; | ||
|
||
/** | ||
* Enumeration of Database products we have tested, and | ||
* for which we ship drivers for. One caviat is the | ||
* Oracle Driver which cannot be shipped due to | ||
* restrictions on its license. | ||
* | ||
* @since 09/11/17 | ||
* @author kstam | ||
* | ||
*/ | ||
public enum DatabaseProduct { | ||
APACHE_DERBY, ORACLE, POSTGRESQL; | ||
|
||
/** | ||
* Can be used to convert '_' to ' ' in the enum | ||
* name. | ||
* | ||
* @return name of the enum. | ||
*/ | ||
public String nameWithSpaces() { | ||
return name().replaceAll("_", " "); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...ctors/sql-stored-connector/src/main/java/io/syndesis/connector/JSONBeanSchemaBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* 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 io.syndesis.connector; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* JSON Schema builder for the simple schema's the SQL Stored Connector uses. | ||
* | ||
* The schema is created so it can be passed on to the dataMapper. An example | ||
* schema looks like | ||
* | ||
* <pre> | ||
* {@code | ||
* "$schema": "http://json-schema.org/schema#", | ||
* "type" : "object", | ||
* "properties" : { | ||
* "a" : {"type" : "integer"}, | ||
* "b" : {"type" : "integer"} | ||
* } | ||
* } | ||
* </pre> | ||
* | ||
* @author kstam | ||
* @since 09/11/2017 | ||
* | ||
*/ | ||
public class JSONBeanSchemaBuilder { | ||
|
||
final static String SCHEMA = "{\n" + | ||
" \"$schema\": \"http://json-schema.org/schema#\",\n" + | ||
" \"type\" : \"object\",\n" + | ||
" \"properties\" : {\n%s\n } \n}"; | ||
List<String> fields = new ArrayList<String>(); | ||
|
||
public JSONBeanSchemaBuilder addField(String name, String type) { | ||
fields.add(String.format(" \"%s\" : {\"type\" : \"%s\"}", name, type)); | ||
return this; | ||
} | ||
|
||
public String build() { | ||
String fieldString = ""; | ||
int count = 0; | ||
for (String field : fields) { | ||
fieldString += field; | ||
if ( fields.size()!=++count ) fieldString += ",\n"; | ||
} | ||
return String.format(SCHEMA, fieldString); | ||
} | ||
} |
Oops, something went wrong.