Skip to content

Commit

Permalink
RC1 - tagging 1.1.4.82
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Contreras committed Mar 27, 2018
1 parent f233b48 commit 6af19eb
Show file tree
Hide file tree
Showing 14 changed files with 609 additions and 341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ public class Constants {
public interface Strings {
String PKG = "go_spatial.com.github.tegola.android.controller";
String GPKG_BUNDLE_SUBDIR = "gpkg-bundle";
String GPKG_BUNDLE_VERSION_PROPS__FNAME = "version.properties";
String GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__TOML_FILE = "TOML_FILE";
String GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__TOML_VERSION = "TOML_VERSION";
String GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__GPKG_FILES = "GPKG_FILES";
String GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__GPKG_VERSIONS = "GPKG_VERSIONS";

interface INTENT {
interface ACTION {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;


public class ControllerFGS extends Service {
Expand Down Expand Up @@ -156,22 +156,10 @@ private void init() {
e.printStackTrace();
}

//grab tegola bin version string from version.properties output from latest bin build
InputStream f_inputstream_version_props = null;
try {
f_inputstream_version_props = getApplicationContext().getAssets().open("version.properties");
String s_version = Utils.getProperty(f_inputstream_version_props, "TEGOLA_BIN_VER");
if (s_version != null)
Constants.Enums.TEGOLA_BIN.set_version_string(s_version);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (f_inputstream_version_props != null) {
try {
f_inputstream_version_props.close();
} catch (IOException e) {}
}
}
//grab tegola bin version string from tegola_version.properties output from latest bin build
String s_version = Utils.getAssetProperty(getApplicationContext(), "tegola_version.properties", "TEGOLA_BIN_VER");
if (s_version != null)
Constants.Enums.TEGOLA_BIN.set_version_string(s_version);

//create geopackage bundle dir
try {
Expand Down Expand Up @@ -349,20 +337,38 @@ private boolean start_tegola(@NonNull final MVT_SERVER_START_SPEC server_start_s
}
f_gpkg_bundle = new File(f_gpkg_bundles_root_dir.getPath(), server_start_spec__gpkg_provider.gpkg_bundle);
if (!f_gpkg_bundle.exists())
throw new FileNotFoundException("geopcackage-bundle " + f_gpkg_bundle.getCanonicalPath()+ " not found");
throw new FileNotFoundException("geopcackage-bundle " + f_gpkg_bundle.getCanonicalPath() + " not found");
Log.d(TAG, "start_tegola: found/using gpkg-bundle: " + f_gpkg_bundle.getName());
f_gpkg_bundle__toml = new File(f_gpkg_bundle.getPath(), getString(R.string.canon_fname__toml));

//process version.properties file for this gpk-bundle
File f_gpkg_bundle_ver_props = new File(f_gpkg_bundle.getPath(), Constants.Strings.GPKG_BUNDLE_VERSION_PROPS__FNAME);
if (!f_gpkg_bundle_ver_props.exists())
throw new FileNotFoundException("geopcackage-bundle version.properties file " + f_gpkg_bundle_ver_props.getCanonicalPath() + " not found");
Log.d(TAG, "start_tegola: found/using gpkg-bundle version.properties: " + f_gpkg_bundle_ver_props.getCanonicalPath());
//get gpkg-bundle toml file spec from version.props, confirm existence, then build "--config" arg for tegola commandline
String s_gpkg_bundle__toml = Utils.getProperty(f_gpkg_bundle_ver_props, Constants.Strings.GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__TOML_FILE);
f_gpkg_bundle__toml = new File(f_gpkg_bundle.getPath(), s_gpkg_bundle__toml);
Log.d(TAG, "start_tegola: version.properties: " + Constants.Strings.GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__TOML_FILE + "==" + f_gpkg_bundle__toml.getCanonicalPath());
if (!f_gpkg_bundle__toml.exists())
throw new FileNotFoundException("geopcackage-bundle toml file " + f_gpkg_bundle__toml.getCanonicalPath() + " not found");
Log.d(TAG, "start_tegola: found/using gpkg-bundle toml file: " + f_gpkg_bundle__toml.getCanonicalPath());
als_cmd_line.add("--" + Constants.Strings.TEGOLA_ARG.CONFIG);
als_cmd_line.add(f_gpkg_bundle__toml.getCanonicalPath());
f_gpkg_bundle__gpkg = new File(f_gpkg_bundle.getPath(), getString(R.string.canon_fname__gpkg));
if (!f_gpkg_bundle__gpkg.exists())
throw new FileNotFoundException("geopcackage-bundle gpkg file " + f_gpkg_bundle__gpkg.getCanonicalPath() + " not found");
String s_process_env__GPKG_var_name = "GPKG_PATH";
Log.d(TAG, "start_tegola: found/using gpkg-bundle gpkg file: " + f_gpkg_bundle__gpkg.getCanonicalPath() + "; setting process environment var \"" + s_process_env__GPKG_var_name + "\"");
pb.environment().put(s_process_env__GPKG_var_name, f_gpkg_bundle__gpkg.getCanonicalPath());

//now get gpkg-bundle geopcackages spec from version.props, then confirm existence
String[] s_list_geopcackage_files = Utils.getProperty(f_gpkg_bundle_ver_props, Constants.Strings.GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__GPKG_FILES).split(",");
if (s_list_geopcackage_files != null && s_list_geopcackage_files.length > 0) {
for (int i = 0; i < s_list_geopcackage_files.length; i++) {
String s_gpkg_file = s_list_geopcackage_files[i];
f_gpkg_bundle__gpkg = new File(f_gpkg_bundle.getPath(), s_gpkg_file);
Log.d(TAG, "start_tegola: version.properties: " + Constants.Strings.GPKG_BUNDLE_VERSION_PROPS_PROP_NAME__GPKG_FILES + "[" + i + "] ==" + f_gpkg_bundle__toml.getCanonicalPath());
if (!f_gpkg_bundle__gpkg.exists())
throw new FileNotFoundException("geopcackage-bundle gpkg file " + f_gpkg_bundle__gpkg.getCanonicalPath() + " not found");
Log.d(TAG, "start_tegola: found/using gpkg-bundle gpkg file: " + f_gpkg_bundle__gpkg.getCanonicalPath());
}
} else {
throw new FileNotFoundException("failed to retrieve list of geopackage files from gpkg-bundle version.properties file " + f_gpkg_bundle_ver_props.getCanonicalPath());
}
} else if (server_start_spec instanceof MVT_SERVER_START_SPEC__POSTGIS_PROVIDER) {
final MVT_SERVER_START_SPEC__POSTGIS_PROVIDER server_start_spec_postgis_provider = (MVT_SERVER_START_SPEC__POSTGIS_PROVIDER)server_start_spec;
if (server_start_spec_postgis_provider.config_toml__is_remote)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,43 @@
import okio.Source;

public class Utils {
public static String getProperty(final InputStream f_inputstream_props, final String s_prop_name) throws IOException {
Properties properties = new Properties();
properties.load(f_inputstream_props);
return properties.getProperty(s_prop_name);
public static String getProperty(final File f_props, final String s_prop_name) throws IOException {
InputStream f_inputstream_props = null;
try {
Properties properties = new Properties();
f_inputstream_props = new FileInputStream(f_props);
properties.load(f_inputstream_props);
return properties.getProperty(s_prop_name);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (f_inputstream_props != null) {
try {
f_inputstream_props.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
public static String getAssetProperty(final Context context, final String s_props_filename, final String s_prop_name) {
InputStream f_is_props = null;
InputStream f_inputstream_props = null;
try {
Properties properties = new Properties();
f_is_props = context.getAssets().open(s_props_filename);
properties.load(f_is_props);
f_inputstream_props = context.getAssets().open(s_props_filename);
properties.load(f_inputstream_props);
return properties.getProperty(s_prop_name);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (f_is_props != null) {
if (f_inputstream_props != null) {
try {
f_is_props.close();
f_inputstream_props.close();
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@
<string name="stop">Stop</string>
<string name="stopping">STOPPING...</string>
<string name="stopped">STOPPED</string>

<string name="canon_fname__toml">config.toml</string>
<string name="canon_fname__gpkg">gpkg</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ else
echo build_tegola.sh: go build command: pre-exec: go build env vars: save: result: FAILED to save to ${OUTPUT_DIR}/go_env.txt
fi

# track ver in version.properties in output dir
ver_props_fn=version.properties
# track ver in tegola_version.properties in output dir
ver_props_fn=tegola_version.properties
rm ${OUTPUT_DIR}/$ver_props_fn > /dev/null 2>&1
echo TEGOLA_BIN_VER=${TEGOLA_VER_STRING}>${OUTPUT_DIR}/${ver_props_fn}
if [[ -e ${OUTPUT_DIR}/${ver_props_fn} ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ case $GOOS in
;;
esac

# remove version.properties file from VER_PROPS__DIR if it exists...
ver_props_fn=version.properties
# remove tegola_version.properties file from VER_PROPS__DIR if it exists...
ver_props_fn=tegola_version.properties
if [[ -n "${VER_PROPS__DIR}" ]]; then
if [[ -e ${VER_PROPS__DIR}/ ]]; then
echo clean_tegola.sh: Cleaning ${VER_PROPS__DIR}/$ver_props_fn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ if exist %OUTPUT_DIR%\go_env.txt (
echo build_tegola.bat: go build command: pre-exec: go build env vars: save: result: FAILED to save to %OUTPUT_DIR%\go_env.txt
)

REM track ver in version.properties in output dir
set ver_props_fn=version.properties
REM track ver in tegola_version.properties in output dir
set ver_props_fn=tegola_version.properties
rm %OUTPUT_DIR%/$ver_props_fn% > /dev/null 2>&1
@echo TEGOLA_BIN_VER=%TEGOLA_VER_STRING%>%OUTPUT_DIR%\%ver_props_fn%
if exist %OUTPUT_DIR%\%ver_props_fn% (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ set BASE_TEGOLA_SUBDIR=github.com\go-spatial\tegola
goto :switch-case-end--GOOS
:switch-case-end--GOOS

REM remove version.properties file from VER_PROPS__DIR if it exists...
set ver_props_fn=version.properties
REM remove tegola_version.properties file from VER_PROPS__DIR if it exists...
set ver_props_fn=tegola_version.properties
if defined VER_PROPS__DIR (
if exist %VER_PROPS__DIR%\ (
echo clean_tegola.bat: Cleaning %VER_PROPS__DIR%\%ver_props_fn%...
Expand Down
Loading

0 comments on commit 6af19eb

Please sign in to comment.