forked from apache/hop
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing issue apache#2167 : Create a new REST API
- Loading branch information
1 parent
b832b15
commit ea237a3
Showing
23 changed files
with
1,533 additions
and
85 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 |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
!/assemblies/web/target | ||
!/assemblies/plugins/dist/target | ||
!/docker | ||
!/rest | ||
!google-key-apache-hop-it.json |
30 changes: 30 additions & 0 deletions
30
core/src/main/java/org/apache/hop/core/config/IRestServicesProvider.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,30 @@ | ||
/* | ||
* 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.hop.core.config; | ||
|
||
import java.util.Properties; | ||
import org.apache.hop.metadata.api.IHasHopMetadataProvider; | ||
|
||
/** This signals that the implementing class provides a Properties object. | ||
* It also needs to be able to handle metadata providers so that plugins can add/remove providers. */ | ||
public interface IRestServicesProvider { | ||
Properties getProperties(); | ||
|
||
IHasHopMetadataProvider getHasHopMetadataProvider(); | ||
} |
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,63 @@ | ||
# 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. | ||
# | ||
|
||
FROM tomcat:10-jdk11-openjdk | ||
LABEL maintainer="Apache Hop Team" | ||
ENV HOP_CONFIG_FOLDER="" | ||
ENV HOP_AES_ENCODER_KEY="" | ||
ENV HOP_AUDIT_FOLDER="${CATALINA_HOME}/webapps/ROOT/audit" | ||
ENV HOP_CONFIG_FOLDER="${CATALINA_HOME}/webapps/ROOT/config" | ||
# specify the hop log level | ||
ENV HOP_LOG_LEVEL="Basic" | ||
# any JRE settings you want to pass on | ||
# The “-XX:+AggressiveHeap” tells the container to use all memory assigned to the container. | ||
# this removed the need to calculate the necessary heap Xmx | ||
ENV HOP_OPTIONS="-Xmx4g" | ||
ENV HOP_PASSWORD_ENCODER_PLUGIN="Hop" | ||
ENV HOP_PLUGIN_BASE_FOLDERS="plugins" | ||
# path to jdbc drivers | ||
ENV HOP_SHARED_JDBC_FOLDER="" | ||
ENV HOP_REST_CONFIG_FOLDER="/config" | ||
|
||
# Set TOMCAT start variables | ||
ENV CATALINA_OPTS='${HOP_OPTIONS} \ | ||
-DHOP_AES_ENCODER_KEY="${HOP_AES_ENCODER_KEY}" \ | ||
-DHOP_AUDIT_FOLDER="${HOP_AUDIT_FOLDER}" \ | ||
-DHOP_CONFIG_FOLDER="${HOP_CONFIG_FOLDER}" \ | ||
-DHOP_LOG_LEVEL="${HOP_LOG_LEVEL}" \ | ||
-DHOP_PASSWORD_ENCODER_PLUGIN="${HOP_PASSWORD_ENCODER_PLUGIN}" \ | ||
-DHOP_PLUGIN_BASE_FOLDERS="${HOP_PLUGIN_BASE_FOLDERS}" \ | ||
-DHOP_REST_CONFIG_FOLDER="${HOP_REST_CONFIG_FOLDER}" \ | ||
-DHOP_SHARED_JDBC_FOLDER="${HOP_SHARED_JDBC_FOLDER}"\' | ||
|
||
# Cleanup and create folder | ||
# | ||
RUN rm -rf webapps/* | ||
|
||
# Copy resources | ||
# | ||
COPY ./assemblies/plugins/dist/target/plugins "${CATALINA_HOME}"/plugins | ||
COPY ./rest/target/hop-rest*.war "${CATALINA_HOME}"/webapps/hop.war | ||
|
||
# Copy the run script | ||
# | ||
COPY ./docker/resources/run-rest.sh /tmp/ | ||
|
||
RUN mkdir -p "$CATALINA_HOME"/lib/swt/linux/x86_64 | ||
|
||
CMD ["/bin/bash", "/tmp/run-rest.sh"] |
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,51 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# 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. | ||
# | ||
|
||
# set working dir to current location | ||
# | ||
cd "${0%/*}" | ||
|
||
REST_TARGET=../rest/target/webapp | ||
|
||
# unzip files for docker image | ||
# | ||
unzip -qu ../rest/target/hop-rest*.war -d ${REST_TARGET} | ||
unzip -qu ../assemblies/plugins/dist/target/hop-assemblies-*.zip -d ../assemblies/plugins/dist/target/ | ||
|
||
# Copy recent changes in libraries. | ||
# | ||
echo "Copying Hop jar files from the target folders." | ||
cp ../core/target/hop-core-*SNAPSHOT.jar ${REST_TARGET}/WEB-INF/lib/ | ||
cp ../engine/target/hop-engine-*SNAPSHOT.jar ${REST_TARGET}/WEB-INF/lib | ||
cp ../ui/target/hop-ui-*SNAPSHOT.jar ${REST_TARGET}/WEB-INF/lib/ | ||
cp ../rap/target/hop-*SNAPSHOT.jar ${REST_TARGET}/WEB-INF/lib/ | ||
|
||
# Copy recent changes to a few plugins. | ||
# | ||
cp ../plugins/engines/beam/target/hop-plugins*.jar ../assemblies/plugins/dist/target/plugins/engines/beam/ | ||
cp ../plugins/misc/projects/target/hop-plugins*.jar ../assemblies/plugins/dist/target/plugins/misc/projects/ | ||
|
||
# Build the docker image. | ||
# | ||
docker build ../ -f Dockerfile.rest -t hop-rest # --progress=plain --no-cache | ||
|
||
# Cleanup | ||
# | ||
# rm -rf ${REST_TARGET}/ | ||
# rm -rf ../assemblies/plugins/dist/target/plugins |
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
#!/bin/bash | ||
# | ||
# 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. | ||
# | ||
|
||
log() { | ||
echo `date '+%Y/%m/%d %H:%M:%S'`" - ${1}" | ||
} | ||
|
||
# | ||
# Stopping a running hop web container with 'docker stop' is obviously possible. | ||
# Doing it with CTRL-C is just more convenient. | ||
# So we'll start the catalina.sh script in the background and wait until | ||
# we trap SIGINT or SIGTERM. At that point we'll simply stop Tomcat. | ||
# | ||
catalina.sh run & | ||
pid="$!" | ||
log "Running Apache Tomcat / Hop REST with PID ${pid}" | ||
trap "log 'Stopping Tomcat'; catalina.sh stop" SIGINT SIGTERM | ||
|
||
while kill -0 $pid > /dev/null 2>&1; do | ||
wait | ||
done |
Oops, something went wrong.