Create ArtifactoryProcess.groovy

Invoke with:

groovy ArtifactoryProcess.groovy [--dry-run] [--full-log] --function <func> --value <val> --web-server http://YourWebServer --repository yourRepoName --domain <com/YourOrg> Version1 ...
 --domain domain         : Name of the domain to scan.
 --dry-run               : Don't change anything; just list what would be done
 --full-log              : Log miscellaneous steps for processing artifacts
 --function function     : function to perform on artifacts
 --maxInState maxInState : name of csv file with states and max counts, optional
 --must-have mustHave    : property required before applying delete, mark,
                           download or clear, optional
 --password password     : Password to use to access Artifactory server.
 --repository repoName   : Name of the repository to scan.
 --targetDir targetDir   : target directory for downloaded artifacts
 --userName userName     : userName to use to access Artifactory server
 --value value           : value to use with function above, often required
 --web-server webServer  : URL to use to access Artifactory server

  Example: groovy ArtifactoryCleanup.groovy --domain domain --dry-run --full-log --function function --maxInState maxInState.csv --must-have mustHave --password password --repository repoName --targetDir targetDir --userName userName --value value --web-server webServer 1.0.1 1.0.2

  Supported functions include [clear, delete, config, download, mark, repoPrint]

  Columns in config csv files can be [repoName, targetDir, maxInState, domain, value, userName, mustHave, webServer, password, function]

The ArtifactoryProcess script can be used in a couple of main modes as well as
a sort of hyper mode.

The first mode is to mark sets of artifacts as being in a particular state, e.g.
groovy.bat ArtifactoryProcess.groovy --function mark --value production --web-server http://YourWebServer/ --repository yourRepoName --domain <com.YourOrg> --userName fill-in-userID --password fill-in-password 1.0.45-zdf
would mark all artifacts in yourRepoName with a version of 1.0.45-zdf as
being in production.

The other mode is to cleanup old artifacts.  This could be done in two stages
where previously marked artifacts are deleted and then additional artifacts
would be marked for deletion on the next run.

Whether the cleanup is done in two stages or one, the different states in which
an artifact can be is defined in a comma separated value (csv) file which has
the name of the state and the number of artifacts to retain in that state.  The
last entry in the MaxInState.csv file is an unnamed state and is the maximum
number of otherwise unmarked artifacts should be retained.

There is also a hyper-mode (function config) where each step of a clean up is
read from a comma separated value (csv) file.  In this case the first line will
name the parameters which are to be specified and the values for each step will
be in the following lines.  It is recommended that parameters like user ID and 
password be passed on the command line, not in the config file.

To run the script, it can be run from the git root as suggested above.  However,
this requires that groovy 2.3 or higher be installed (parameters to closure 
support was added then and is required for the closure implementation used).
This requires that your JVM be at least 1.7.  If you do not wish to install
groovy on your server, you can comment out the @Grapes sections at the top (oh 
for the conditional compilations of c days gone) and build the required jar file
with 'gradlew build'.  You can then run the utility with something like:
java -jar build/libs/artifactoryProcess-run.jar --dry-run --full-log --function mark --value tested --web-server http://YourWebServer/ --repository yourRepoName  --domain <com.YourOrg> --userName fill-in-userID --password fill-in-password 1.0.45-zdf
Merge pull request #2 from brianpcarr/patch-1

Create ArtifactoryProcess.groovy