I am trying to do an export of all the components defined in vFabric AppDir (6.01) using the Java CLI. If I were to program it using a combination of Powershell and Java it would look something like this:
# PScript to export vFabric Components to the TempDir
# Variables
$AppDirServer = "vFabricAppDirServer"
$loginAcct = "darwin_user"
$loginAcctPass = "This Is the Password field"
$dateStr = Get-Date -uformat "%Y.%m.%d"
$outputDir = "T:\Exports\" + $dateStr
# Start the java vApp Dir CLI client
java -jar darwin-cli.jar
# Java CLI commands (commands to the CLI from here down)
# Log into the vFabric AppDir server
login --serverUrl https://$AppDirServer:8443/darwin --username $loginAcct --password $loginAcctPass
# Export Applications
export-package --exportFilePath $outputDir + "\allApplications.pkg" --applicationVersion ALL
# Export Services
export-package --exportFilePath $outputDir + "\allServices.pkg" --serviceVersion ALL
# Export Tasks
export-package --exportFilePath $outputDir + "\allTasks.pkg" --taskVersion ALL
# Export External Services
export-package --exportFilePath $outputDir + "\allExternalServices.pkg" --externalServiceVersion ALL
# Export Policies
export-package --exportFilePath $outputDir + "\allPolicies.pkg" --policyVersion ALL
# logout of the session
logout
# Exit the AppDir CLI
exit
I have the CLI jar file accessible to powershell and can start it interactively. I can also enter each of the lines interactively into the CLI and have them execute... My thought then is to do something like:
# PScript to export vFabric Components to the TempDir
# Variables
$AppDirServer = "vFabricAppDirServer"
$loginAcct = "darwin_user"
$loginAcctPass = "This Is the Password field"
$dateStr = Get-Date -uformat "%Y.%m.%d"
$outputDir = "T:\Exports\" + $dateStr
$outputTempDir = "T:\Exports\TempDir"
# Start the java vApp Dir CLI client
java -jar darwin-cli.jar < CLI-cmds.txt
# move the output fiels to their home
move $outputTempDir + "/*" $outputDir
where CLI-cmds.txt is:
# Log into the vFabric AppDir server
login --serverUrl https://$AppDirServer:8443/darwin --username $loginAcct --password $loginAcctPass
# Export Applications
export-package --exportFilePath $outputDir + "\allApplications.pkg" --applicationVersion ALL
# Export Services
export-package --exportFilePath $outputDir + "\allServices.pkg" --serviceVersion ALL
# Export Tasks
export-package --exportFilePath $outputDir + "\allTasks.pkg" --taskVersion ALL
# Export External Services
export-package --exportFilePath $outputDir + "\allExternalServices.pkg" --externalServiceVersion ALL
# Export Policies
export-package --exportFilePath $outputDir + "\allPolicies.pkg" --policyVersion ALL
# logout of the session
logout
# Exit the AppDir CLI
exit
Of course, the < (redirect) does not work. So my question then (after much tldr; and I checked the java site)...
Is there a way to have these commands sent to the CLI when I invoke the java -jar darwin-cli.jar command??
Thanks in advance,
Roger