This repository has been archived by the owner on May 22, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(elasticsearch) Add HTTP support
Closes gravitee-io/issues#871
- Loading branch information
1 parent
ef94901
commit a080dca
Showing
66 changed files
with
6,178 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,245 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
Licensed 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. | ||
--> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.gravitee.repository</groupId> | ||
<artifactId>gravitee-repository-elasticsearch</artifactId> | ||
<version>1.11.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>gravitee-repository-elasticsearch-http</artifactId> | ||
<name>Gravitee.io APIM - Repository - Elasticsearch - HTTP client</name> | ||
|
||
<properties> | ||
<freemarker.version>2.3.26-incubating</freemarker.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Gravitee dependencies --> | ||
<dependency> | ||
<groupId>io.gravitee.repository</groupId> | ||
<artifactId>gravitee-repository</artifactId> | ||
<version>${gravitee-repository.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Vertx.io HTTP client --> | ||
<dependency> | ||
<groupId>io.vertx</groupId> | ||
<artifactId>vertx-rx-java</artifactId> | ||
<version>${vertx.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.vertx</groupId> | ||
<artifactId>vertx-core</artifactId> | ||
<version>${vertx.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Used to consume JSON REST services --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
</dependency> | ||
|
||
<!-- Logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-core</artifactId> | ||
</dependency> | ||
|
||
<!-- Spring dependencies --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>${spring.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>${spring.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.freemarker</groupId> | ||
<artifactId>freemarker</artifactId> | ||
<version>${freemarker.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Unit Tests --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<version>${spring.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jsr310</artifactId> | ||
<version>${jackson.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.unitils</groupId> | ||
<artifactId>unitils-core</artifactId> | ||
<version>3.4.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Elasticsearch dependencies --> | ||
<dependency> | ||
<groupId>org.elasticsearch</groupId> | ||
<artifactId>elasticsearch</artifactId> | ||
<scope>test</scope> | ||
<version>${elasticsearch.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.dataformat</groupId> | ||
<artifactId>jackson-dataformat-smile</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.dataformat</groupId> | ||
<artifactId>jackson-dataformat-yaml</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.dataformat</groupId> | ||
<artifactId>jackson-dataformat-cbor</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
<descriptors> | ||
<descriptor>src/main/assembly/plugin-assembly.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-plugin-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<es.set.netty.runtime.available.processors>false</es.set.netty.runtime.available.processors> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>es-2x</id> | ||
<properties> | ||
<elasticsearch.version>2.4.6</elasticsearch.version> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>es-5x</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<elasticsearch.version>5.6.3</elasticsearch.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.elasticsearch.client</groupId> | ||
<artifactId>transport</artifactId> | ||
<version>${elasticsearch.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-all</artifactId> | ||
<version>4.1.13.Final</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<version>2.9.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
40 changes: 40 additions & 0 deletions
40
gravitee-repository-elasticsearch-http/src/main/assembly/plugin-assembly.xml
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,40 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
Licensed 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. | ||
--> | ||
<assembly> | ||
<id>plugin</id> | ||
<formats> | ||
<format>zip</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
|
||
<!-- Include the main plugin Jar file --> | ||
<files> | ||
<file> | ||
<source>${project.build.directory}/${project.build.finalName}.jar</source> | ||
</file> | ||
</files> | ||
|
||
<!-- Finally include plugin dependencies --> | ||
<dependencySets> | ||
<dependencySet> | ||
<outputDirectory>lib</outputDirectory> | ||
<useProjectArtifact>false</useProjectArtifact> | ||
</dependencySet> | ||
</dependencySets> | ||
</assembly> |
48 changes: 48 additions & 0 deletions
48
...ch-http/src/main/java/io/gravitee/repository/elasticsearch/AbstractElasticRepository.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,48 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed 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.gravitee.repository.elasticsearch; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import io.gravitee.repository.elasticsearch.utils.ElasticsearchIndexUtil; | ||
import io.gravitee.repository.elasticsearch.utils.FreeMarkerComponent; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author Guillaume Waignier (zenika) | ||
* @author Sebastien Devaux (zenika) | ||
* @author GraviteeSource Team | ||
*/ | ||
public abstract class AbstractElasticRepository { | ||
|
||
/** | ||
* Elasticsearch component to perform HTTP request. | ||
*/ | ||
@Autowired | ||
protected ElasticsearchComponent elasticsearchComponent; | ||
|
||
/** | ||
* Templating component | ||
*/ | ||
@Autowired | ||
protected FreeMarkerComponent freeMarkerComponent; | ||
|
||
/** | ||
* Util component used to compute index name. | ||
*/ | ||
@Autowired | ||
protected ElasticsearchIndexUtil elasticsearchIndexUtil; | ||
} |
49 changes: 49 additions & 0 deletions
49
...sticsearch-http/src/main/java/io/gravitee/repository/elasticsearch/ElasticRepository.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,49 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed 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.gravitee.repository.elasticsearch; | ||
|
||
import io.gravitee.repository.Repository; | ||
import io.gravitee.repository.Scope; | ||
import io.gravitee.repository.elasticsearch.spring.AnalyticsRepositoryConfiguration; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class ElasticRepository implements Repository { | ||
|
||
@Override | ||
public String type() { | ||
return "elasticsearch"; | ||
} | ||
|
||
@Override | ||
public Scope[] scopes() { | ||
return new Scope [] { | ||
Scope.ANALYTICS | ||
}; | ||
} | ||
|
||
@Override | ||
public Class<?> configuration(Scope scope) { | ||
switch (scope) { | ||
case ANALYTICS: | ||
return AnalyticsRepositoryConfiguration.class; | ||
default: | ||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.