@echo off
setlocal enableextensions enabledelayedexpansion

rem THIS BATCH SCRIPT FILE SHOWS THE SAMPLE TO INSTALL DOCUMENTUM REST ARTIFACTS TO A LOCAL MAVEN REPOSITORY.
rem USERS NEED TO UPDATE BELOW VARIABLES BEFORE RUNNING THE SCRIPT.

set DCTM_REST_SDK=C:/workspace/dctm-rest-sdk-7.2
set DCTM_DFC_VERSION=7.2.0-SNAPSHOT
set DCTM_REST_VERSION=7.2.0000.0242

set DCTM_DFC_GROUP_ID=com.emc.documentum.dfc
set DCTM_REST_GROUP_ID=com.emc.documentum.rest

:install-dfc
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/dctm/dfc-7.2.0-20150109.120126-17.jar -DpomFile=%DCTM_REST_SDK%/lib/dependencies/dctm/dfc-7.2.0-SNAPSHOT.pom
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/dctm/dms-client-api-7.2.0-20150109.141907-6.jar -DgroupId=com.emc.documentum.dms.client -DartifactId=dms-client-api -Dversion=7.2.0-SNAPSHOT -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/dctm/configservice-api-7.2.0-20150109.120223-17.jar -DgroupId=com.emc.documentum.dfc -DartifactId=configservice-api -Dversion=7.2.0-SNAPSHOT -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/configservice-impl-7.2.0-20150109.120332-17.jar -DgroupId=com.emc.documentum.services.config -DartifactId=configservice-impl -Dversion=7.2.0-SNAPSHOT -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/krbutil-7.2.0-20150109.120210-17.jar -DgroupId=com.emc.documentum.dfc -DartifactId=krbutil -Dversion=7.2.0-SNAPSHOT -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/xtrim-api-6.7.1000.0003.jar -DgroupId=com.emc.documentum.fs2 -DartifactId=xtrim-api -Dversion=6.7.1000.0003 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/xtrim-server-6.7.1000.0003.jar -DgroupId=com.emc.documentum.fs2 -DartifactId=xtrim-server -Dversion=6.7.1000.0003 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/aspectjrt-1.5.2a.jar -DgroupId=aspectj -DartifactId=aspectjrt -Dversion=1.5.2a -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/jcifs-krb5-1.3.1.jar -DgroupId=jcifs -DartifactId=jcifs-krb5 -Dversion=1.3.1 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/All-MB-2.0.jar -DgroupId=apple.macbinary -DartifactId=ALL-MB -Dversion=2.0 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/certj-5.2.jar -DgroupId=com.emc.rsa.certj -DartifactId=certj -Dversion=5.2 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/cryptoj-6.1.2.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=cryptoj -Dversion=6.1.2 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/cryptojce-6.1.2.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=cryptojce -Dversion=6.1.2 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/cryptojcommon-6.1.2.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=cryptojcommon -Dversion=6.1.2 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/util-6.1.2.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=util -Dversion=6.1.2 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/jcmandroidfips-6.1.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=jcmandroidfips -Dversion=6.1 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/jcm-6.1.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=jcm -Dversion=6.1 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/jcmFIPS-6.1.jar -DgroupId=com.emc.rsa.cryptoj -DartifactId=jcmFIPS -Dversion=6.1 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/vsj-license-3.3.jar -DgroupId=vsj -DartifactId=vsj-license -Dversion=3.3 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/vsj-standard-3.3.jar -DgroupId=vsj -DartifactId=vsj-standard -Dversion=3.3 -Dpackaging=jar
call mvn install:install-file -Dfile=%DCTM_REST_SDK%/lib/dependencies/questFixForJDK7-3.3.jar -DgroupId=quest -DartifactId=questFixForJDK7 -Dversion=3.3 -Dpackaging=jar

:install-core
for %%f in (%DCTM_REST_SDK%/lib/core\*) do (
    set "ext=%%~xf"
    rem echo Checking "!ext!"...
    if ".pom" == "!ext!" (
    	set "name=%%~dpnf"
    	echo Installing "!name!.jar"...
    	call mvn install:install-file -Dfile="!name!.jar" -DpomFile="!name!.pom"
	)
)

:install-war
for %%f in (%DCTM_REST_SDK%/lib/war\*) do (
    set "ext=%%~xf"
    rem echo Checking "!ext!"...
    if ".war" == "!ext!" (
    	set "name=%%~dpnxf"
    	echo Installing "!name!"...
    	call mvn install:install-file -Dfile="!name!" -DgroupId=%DCTM_REST_GROUP_ID% -DartifactId=documentum-rest-web -Dversion=%DCTM_REST_VERSION% -Dpackaging=war
	)
)

:install-plugin
for %%f in (%DCTM_REST_SDK%/tools\*) do (
    set "name=%%~nxf"
    rem echo Checking "!name!"...
    if "documentum-rest-extension-validating-%DCTM_REST_VERSION%.jar" == "!name!" (
    	set "filename=%%~dpnxf"
    	set "filepath=%%~dpf"
    	echo Installing "!filename!"...
    	call mvn install:install-file -Dfile="!filename!" -DpomFile="!filepath!/pom.xml"
	)
)

:eof