Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/main/resources/mapcode-secret.properties
target/
out/
target/

33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The available REST API methods are:
count : Return 'count' items at most.


## Building The REST API Service
## Build and Run: Missing `mapcode-secret.properties` File

To build and run the REST API, type:

Expand Down Expand Up @@ -130,6 +130,37 @@ Or use a tool like cURL:

There's also an example HTML page in the `examples/index.html` for HTML/Javascript developers.

# Using Git and `.gitignore`

It's good practice to set up a personal global `.gitignore` file on your machine which filters a number of files
on your file systems that you do not wish to submit to the Git repository. You can set up your own global
`~/.gitignore` file by executing:
`git config --global core.excludesfile ~/.gitignore`

In general, add the following file types to `~/.gitignore` (each entry should be on a separate line):
`*.com *.class *.dll *.exe *.o *.so *.log *.sql *.sqlite *.tlog *.epoch *.swp *.hprof *.hprof.index *.releaseBackup *~`

If you're using a Mac, filter:
`.DS_Store* Thumbs.db`

If you're using IntelliJ IDEA, filter:
`*.iml *.iws .idea/`

If you're using Eclips, filter:
`.classpath .project .settings .cache`

If you're using NetBeans, filter:
`nb-configuration.xml *.orig`

The local `.gitignore` file in the Git repository itself to reflect those file only that are produced by executing
regular compile, build or release commands, such as:
`target/ out/`

# Bug Reports and New Feature Requests

If you encounter any problems with this library, don't hesitate to use the `Issues` session to file your issues.
Normally, one of our developers should be able to comment on them and fix.


## Release Notes

Expand Down
131 changes: 130 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<artifactId>mapcode-rest-service</artifactId>

<packaging>war</packaging>
<version>2.2.3.4</version>
<version>2.2.3.5</version>

<name>Mapcode REST API Web Service</name>
<description>
Expand Down Expand Up @@ -77,6 +77,7 @@
<!-- Library versions - these are not re-used from the top-level POM to simulate stand-alone usage. -->
<apache-commons-lang.version>3.0</apache-commons-lang.version>
<commons-httpclient.version>3.1</commons-httpclient.version>
<docker-maven-plugin.version>4.0.1</docker-maven-plugin.version>
<guava.version>17.0</guava.version>
<guice.version>3.0</guice.version>
<jackson.version>2.5.2</jackson.version>
Expand All @@ -95,6 +96,7 @@
<maven-javadoc-plugin.version>2.10.1</maven-javadoc-plugin.version>
<maven-jetty-plugin.version>8.1.9.v20130131</maven-jetty-plugin.version>
<maven-tomcat-plugin.version>2.2</maven-tomcat-plugin.version>
<maven-resource-plugin.version>2.7</maven-resource-plugin.version>
<maven-source-plugin.version>2.4</maven-source-plugin.version>
<nexus-staging-maven-plugin.version>1.6.5</nexus-staging-maven-plugin.version>

Expand All @@ -111,6 +113,15 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resource-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down Expand Up @@ -188,6 +199,124 @@
</resources>
</build>

<profiles>
<profile>
<id>docker</id>

<properties>
<!-- TODO: Provide properties - how can we supply proper values here?
<docker.provider>local</docker.provider>
<docker.host>192.168.99.100</docker.host>
<docker.port>2376</docker.port>
-->
</properties>

<build>
<plugins>
<!--
Plugin to build docker image for Mapcode web service.

Note: To have this working there must be an active docker
instance running locally and maven build has to be executed
within the docker VM.
-->
<plugin>
<groupId>net.wouterdanes.docker</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven-plugin.version}</version>
<executions>
<execution>
<id>package</id>
<goals>
<goal>build-images</goal>
</goals>
<configuration>
<images>
<image>
<id>${project.artifactId}</id>
<nameAndTag>${project.artifactId}:${project.version}</nameAndTag>
<keep>true</keep>
<dockerFile>${project.basedir}/src/docker/Dockerfile</dockerFile>
<artifacts>
<artifact>
<file>
${project.build.directory}/${project.artifactId}-${project.version}.war
</file>
<dest>${project.artifactId}.war</dest>
</artifact>
<artifact>
<file>
${project.basedir}/src/config/mapcode-secret.properties
</file>
</artifact>
<artifact>
<file>
${project.basedir}/src/config/tomcat-users.xml
</file>
</artifact>
</artifacts>
</image>
</images>
</configuration>
</execution>

<execution>
<id>start-container</id>
<goals>
<goal>start-containers</goal>
</goals>
<configuration>

<!-- You can set forceCleanup to true to stop and remove started containers
at the end of the build even if the stop-containers goal is not executed
(useful for preventing Ctrl+C causing dangling containers).
-->
<forceCleanup>true</forceCleanup>
<containers>
<container>
<id>${project.artifactId}</id>
<image>${project.artifactId}:${project.version}</image>
<waitForStartup>Server startup in</waitForStartup>
</container>
</containers>
</configuration>
</execution>

<execution>
<id>stop-container</id>
<goals>
<goal>stop-containers</goal>
</goals>
</execution>

<!-- TODO: Remove comments to commit the containers.
<execution>
<id>commit</id>
<goals>
<goal>commit-containers</goal>
</goals>
<configuration>
<containers>
<container>
<id>${project.artifactId}</id>
<tag>${project.version}</tag>
<comment>Build ${project.artifactId} version ${project.version} at
${maven.build.timestamp}
</comment>
<author>mapcode-foundation</author>
<push>true</push>
</container>
</containers>
</configuration>
</execution>
-->
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>

<!--
Expand Down
7 changes: 7 additions & 0 deletions src/config/mapcode-secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# If you wish to use MongoDB tracing, override these properties:

# MongoDBTrace.writeEnabled = true
# MongoDBTrace.servers = hostname:port
# MongoDBTrace.database = trace_database_name
# MongoDBTrace.userName = some_username
# MongoDBTrace.password = some_password
43 changes: 43 additions & 0 deletions src/config/tomcat-users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
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.
-->
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->

<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->

<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
-->
<role rolename="manager-gui"/>
<user username="admin" password="s3cret" roles="manager-gui"/>
</tomcat-users>
27 changes: 27 additions & 0 deletions src/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2015 Stichting Mapcode Foundation (http://www.mapcode.com)
#
# 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.

FROM tomcat:8.0.20-jre8

MAINTAINER Mapcode-Foundation

ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8

ADD mapcode-rest-service.war /usr/local/tomcat/webapps/
ADD mapcode-secret.properties /usr/local/tomcat/lib/
ADD tomcat-users.xml /usr/local/tomcat/conf/

# RUN mkdir /usr/local/tomcat/webapps/myapp

# COPY /mapcode-foundation /usr/local/tomcat/webapps
6 changes: 2 additions & 4 deletions src/main/resources/mapcode.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
# Copyright (C) 2015 Stichting Mapcode Foundation (http://www.mapcode.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,7 +11,6 @@
# 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.
#

# Override these default properties:

Expand All @@ -29,5 +27,5 @@ MongoDBTrace.connectionTimeoutMsecs = 20000
# MongoDBTrace.writeEnabled = true
MongoDBTrace.servers = localhost:27017
MongoDBTrace.database = trace
MongoDBTrace.userName = x
MongoDBTrace.password = x
MongoDBTrace.userName = {empty}
MongoDBTrace.password = {empty}