Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Closed
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
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ targetCompatibility = "1.7"

repositories {
jcenter()
mavenLocal()
}

dependencies {
compile 'com.marklogic:ml-javaclient-util:2.5'
compile 'com.marklogic:ml-javaclient-util:2.6.2'
compile 'jaxen:jaxen:1.1.6'
compile 'org.apache.httpcomponents:httpclient:4.3.5'
compile 'org.springframework:spring-web:4.1.5.RELEASE'
Expand Down Expand Up @@ -59,9 +60,15 @@ if (project.hasProperty("myBintrayUser")) {
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/rjrudin/' + project.name + '.git'
version {
name = "2.0"
name = "2.1"
released = new Date()
}
}
}
}
}



task wrapper(type: Wrapper) {
gradleVersion = '2.6'
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group=com.marklogic
publishUrl=file:../gh-pages-marklogic-java/releases
javadocsDir=../gh-pages-marklogic-java/javadocs
version=2.0
version=2.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon May 25 15:31:23 EDT 2015
#Tue Jan 26 17:03:35 PST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
10 changes: 3 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ case "`uname`" in
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
Expand All @@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

Expand Down Expand Up @@ -114,6 +109,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down
180 changes: 90 additions & 90 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
38 changes: 32 additions & 6 deletions src/main/java/com/marklogic/appdeployer/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ public class AppConfig {
* The default path from which modules will be loaded into a modules database.
*/
public final static String DEFAULT_MODULES_PATH = "src/main/ml-modules";
public final static String DEFAULT_SCHEMAS_PATH = "src/main/ml-schemas";

public final static String DEFAULT_HOST = "localhost";
public final static String DEFAULT_GROUP = "Default";

private String name = DEFAULT_APP_NAME;
private String host = DEFAULT_HOST;

// Username/password combo for using the client REST API - e.g. to load modules
private String restAdminUsername = DEFAULT_USERNAME;
private String restAdminPassword = DEFAULT_PASSWORD;
Expand All @@ -78,6 +79,7 @@ public class AppConfig {
private String schemasDatabaseName;

private List<String> modulePaths;
private String schemasPath;
private ConfigDir configDir;

// Passed into the TokenReplacer that subclasses of AbstractCommand use
Expand All @@ -100,14 +102,16 @@ public class AppConfig {
// Comma-delimited string used for configuring forest replicas
private String databaseNamesAndReplicaCounts;

public AppConfig() {
this(DEFAULT_MODULES_PATH);

public AppConfig() {
this(DEFAULT_MODULES_PATH, DEFAULT_SCHEMAS_PATH);
}

public AppConfig(String defaultModulePath) {
public AppConfig(String defaultModulePath, String defaultSchemasPath) {
modulePaths = new ArrayList<String>();
modulePaths.add(defaultModulePath);
configDir = new ConfigDir();
schemasPath = defaultSchemasPath;
}

public void setSimpleSslConfig() {
Expand Down Expand Up @@ -135,6 +139,18 @@ public DatabaseClient newTestDatabaseClient() {
return DatabaseClientFactory.newClient(getHost(), getTestRestPort(), getRestAdminUsername(),
getRestAdminPassword(), getRestAuthentication(), getRestSslContext(), getRestSslHostnameVerifier());
}

/**
* Like newDatabaseClient, but connects to schemas database.
*
* @return
*/
public DatabaseClient newSchemasDatabaseClient() {
return DatabaseClientFactory.newClient(getHost(), getRestPort(), getSchemasDatabaseName(),
getRestAdminUsername(), getRestAdminPassword(), getRestAuthentication(),
getRestSslContext(), getRestSslHostnameVerifier());
}


/**
* @return an XccAssetLoader based on the configuration properties in this class
Expand Down Expand Up @@ -225,7 +241,7 @@ public String getTriggersDatabaseName() {
public String getSchemasDatabaseName() {
return schemasDatabaseName != null ? schemasDatabaseName : name + "-schemas";
}

/**
* @return the name of the application, which is then used to generate app server and database names unless those
* are set via their respective properties
Expand Down Expand Up @@ -294,6 +310,17 @@ public void setTestRestPort(Integer testRestPort) {
this.testRestPort = testRestPort;
}

/**
* @return a list of all the paths from which modules should be loaded into a REST API server modules database
*/
public String getSchemasPath() {
return schemasPath;
}

public void setSchemasPath(String schemasPath) {
this.schemasPath = schemasPath;
}

/**
* @return a list of all the paths from which modules should be loaded into a REST API server modules database
*/
Expand Down Expand Up @@ -458,5 +485,4 @@ public FileFilter getAssetFileFilter() {
public void setAssetFileFilter(FileFilter assetFileFilter) {
this.assetFileFilter = assetFileFilter;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public AppConfig newAppConfig() {
logger.info("Config dir: " + prop);
c.setConfigDir(new ConfigDir(new File(prop)));
}

prop = getProperty("mlSchemasPath");
if (prop != null) {
logger.info("Schemas path: " + prop);
c.setSchemasPath(prop);
}

prop = getProperty("mlHost");
if (prop != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public abstract class SortOrderConstants {
public static Integer UPDATE_REST_API_SERVERS = 250;
public static Integer DEPLOY_OTHER_SERVERS = 300;

// Module code may depend on schemas, but not vice-versa.
public static Integer LOAD_SCHEMAS = 350;

// Modules have to be loaded after the REST API server has been updated, for if the deployer is expecting to load
// modules via SSL, then the REST API server must already be configured with a certificate template
public static Integer LOAD_MODULES = 400;
Expand Down
Loading