diff --git a/.project b/.project
new file mode 100644
index 0000000..a30e836
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ smartgears-distribution
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..d7bf809
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,5 @@
+#Wed Sep 25 11:08:37 CEST 2013
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/distro/LICENSE b/distro/LICENSE
new file mode 100644
index 0000000..630ba97
--- /dev/null
+++ b/distro/LICENSE
@@ -0,0 +1,6 @@
+gCube System - License
+------------------------------------------------------------
+
+The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
+The software and documentation is provided by its authors/distributors "as is" and no expressed or
+implied warranty is given for its use, quality or fitness for a particular case.
diff --git a/distro/MAINTAINERS b/distro/MAINTAINERS
new file mode 100644
index 0000000..5e8aa8f
--- /dev/null
+++ b/distro/MAINTAINERS
@@ -0,0 +1 @@
+* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy
\ No newline at end of file
diff --git a/distro/README b/distro/README
new file mode 100644
index 0000000..b73e693
--- /dev/null
+++ b/distro/README
@@ -0,0 +1,38 @@
+The gCube System - ${name}
+----------------------
+
+This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
+D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
+
+Authors
+-------
+
+* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy.
+
+Version and Release Date
+------------------------
+${version}
+
+Description
+-----------
+${description}
+
+Download information
+--------------------
+
+Source code is available from SVN:
+${scm.url}
+
+Binaries can be downloaded from:
+
+
+Documentation
+-------------
+Documentation is available on-line from the Projects Documentation Wiki:
+https://gcube.wiki.gcube-system.org/gcube/index.php/....
+
+
+Licensing
+---------
+
+This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
diff --git a/distro/changelog.xml b/distro/changelog.xml
new file mode 100644
index 0000000..bc6e67b
--- /dev/null
+++ b/distro/changelog.xml
@@ -0,0 +1,5 @@
+
+
+ First Release
+
+
\ No newline at end of file
diff --git a/distro/contents/install b/distro/contents/install
new file mode 100755
index 0000000..34b0d20
--- /dev/null
+++ b/distro/contents/install
@@ -0,0 +1,188 @@
+
+#set distro to script's parent directory
+distro=$(cd ${0%/*} && echo $PWD/${0##*/})
+distro=$(dirname $distro)
+
+echo "distro:$distro"
+
+distrolibs=$distro/libs
+distroapps=$distro/apps
+distroscripts=$distro/scripts
+liblist=smartgears.list
+
+
+function showhelp {
+ echo -e "\nusage: install [-d ] -s tomcat| -a [app directory] [-g gHN directory] [-x|-h] \n"
+ echo " = the directory with the distribution of SmartGears ${project.version}."
+ echo " By default, this is the parent directory of this script."
+ echo " = the directory with libraries shared by all applications in the target container."
+ echo " = the directory with all the applications in the target container."
+ echo " = the directory with logs and files related to the gCube Hosting Node."
+ echo " By default, this is value of the GHN_HOME env var."
+ echo " tomcat = Sets and for a target Tomcat container."
+ echo " x = dry run."
+ echo -e " h = shows this help.\n"
+}
+
+while getopts ":d:s:g:a:xh" opt; do
+ case $opt in
+ d) distro=$OPTARG;;
+ s) shared=$OPTARG;;
+ g) ghnhome=$OPTARG;;
+ a) apps=$OPTARG;;
+ x) dryrun="true";;
+ h) showhelp
+exit 0 ;;
+ :) echo -e "\nERROR:option -$OPTARG requires an argument." >&2 ;
+ showhelp;
+ echo -e "\naborting.\n"
+ exit 1;;
+ \?) echo -e "\nERROR:invalid option: -$OPTARG";
+ showhelp;
+ echo -e "\naborting.\n"
+ exit 1 >&2 ;;
+ esac
+done
+
+if [ -z "$ghnhome" ]; then
+ if [ -z "$GHN_HOME" ]; then
+ echo -e "\nERROR:please specify the gHN directory (-g) or define the GHN_HOME env var." >&2
+ showhelp
+ echo -e "\naborting.\n"
+ exit 1
+ else
+ ghnhome=$GHN_HOME
+ fi
+fi
+if [ ! -d "$ghnhome" ]; then
+ if [ -z "$dryrun" ]; then
+ mkdir $ghnhome
+ fi
+fi
+
+
+#tomcat target
+if [ "$shared" = "tomcat" ]; then
+ if [ -z "$CATALINA_HOME" ]; then
+ echo -e "\nERROR: env var CATALINA_HOME is undefined." >&2
+ showhelp
+ echo -e "\naborting.\n"
+ exit 1
+ fi
+ shared=$CATALINA_HOME/lib
+ apps=$CATALINA_HOME/webapps
+fi
+
+#shared is set
+if [ -z "$shared" ]; then
+ echo -e "\nERROR: shared directory is undefined (-s)." >&2
+ showhelp
+ echo -e "\naborting.\n"
+ exit 1
+fi
+
+#shared exists and is a directory
+if [ ! -d "$shared" ]; then
+ echo -e "\nERROR: $shared does not exist or is not a directory, aborting." >&2
+ exit 1;
+fi
+
+#shared exists and is a directory
+if [ ! -d "$apps" ]; then
+ echo -e "\nERROR: $apps does not exist or is not a directory, aborting." >&2
+ exit 1;
+fi
+
+#distrolibs exists and is a directory
+if [ ! -d "$distrolibs" ]; then
+ echo -e "\nERROR: $distrolibs does not exist or is not a directory, aborting."
+ exit 1;
+fi
+
+#distroapps exists and is a directory
+if [ ! -d "$distroapps" ]; then
+ echo -e "\nERROR: $distroapps does not exist or is not a directory, aborting."
+ exit 1;
+fi
+
+echo -e "\nInstalling SmartGears ${project.version}\n"
+echo -e " target gHN directory = $(cd $(dirname $ghnhome); pwd)/$(basename $ghnhome)"
+echo -e " target shared directory = $(cd $(dirname $shared); pwd)/$(basename $shared)"
+echo -e " target app directory = $(cd $(dirname $apps); pwd)/$(basename $apps)"
+
+shopt -s nullglob
+
+#uninstall libraries
+if [ -f $shared/$liblist ]; then
+ echo -e "\nuninstalling existing components \c"
+ while read line; do
+ if [ -z "$dryrun" ]; then
+ rm $shared/$line
+ fi
+ echo -n "."
+ sleep .01
+
+ done < $shared/$liblist
+ if [ -z "$dryrun" ]; then
+ rm $shared/$liblist
+ fi
+
+fi
+
+#install libraries
+echo -e "\ninstalling components \c"
+for f in $distrolibs/*.*;
+ do
+ if [ -z "$dryrun" ]; then
+ cp $f $shared/
+ basename $f >> $shared/$liblist
+ fi
+ echo -n "."
+ sleep .01
+ done
+
+
+#install apps
+echo -e "\ninstalling applications \c"
+for f in $distroapps/*;
+ do
+ if [ -z "$dryrun" ]; then
+ cp $f $apps/
+ fi
+ echo -n "."
+ sleep .01
+ done
+
+#install scripts
+echo -e "\ninstalling scripts \c"
+if [ ! -d "$ghnhome/scripts" ]; then
+ if [ -z "$dryrun" ]; then
+ mkdir $ghnhome/scripts
+ fi
+fi
+
+for f in $distroscripts/*;
+ do
+ if [ -z "$dryrun" ]; then
+ cp $f $ghnhome/scripts/
+ fi
+ echo -n "."
+ sleep .01
+ done
+
+#install config
+echo -e "\ninstalling configuration \c"
+if [ ! -d "$ghnhome/container.xml" ]; then
+ if [ -z "$dryrun" ]; then
+ cp $distro/container.xml $ghnhome/
+ fi
+ echo -n "."
+ sleep .01
+fi
+if [ -z "$dryrun" ]; then
+ cat $distro/logback.xml | sed "s|\${LOGFILE}|$ghnhome|" > $shared/logback.xml
+ echo -n "."
+ sleep .01
+fi
+
+echo -e "\ndone.\n"
diff --git a/distro/contents/logback.xml b/distro/contents/logback.xml
new file mode 100644
index 0000000..156620f
--- /dev/null
+++ b/distro/contents/logback.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ ${LOGFILE}/ghn.log
+ true
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/distro/contents/samplecontainer.xml b/distro/contents/samplecontainer.xml
new file mode 100644
index 0000000..cf21e1d
--- /dev/null
+++ b/distro/contents/samplecontainer.xml
@@ -0,0 +1,22 @@
+
+
+ localhost
+ 8080
+ gcube
+ devsec
+
+
+ it
+ rome
+ 41.9000
+ 12.5000
+
+
+
+
+ 60
+
+
\ No newline at end of file
diff --git a/distro/contents/scripts/download b/distro/contents/scripts/download
new file mode 100644
index 0000000..a2bd011
--- /dev/null
+++ b/distro/contents/scripts/download
@@ -0,0 +1,63 @@
+
+group=org.gcube.core
+artifact=common-smartgears
+repo=gcube-releases
+
+function showhelp {
+ echo -e "\nusage: download [-v ] [-s|-h] \n"
+ echo " = the version to download."
+ echo " = By default, this is the latest known version."
+ echo " s = download a snapshot version."
+ echo " x = dry run."
+ echo -e " h = shows this help.\n"
+}
+
+while getopts ":v:sh" opt; do
+ case $opt in
+ v) version=$OPTARG;;
+ s) repo=gcube-snapshots;;
+ h) showhelp
+ exit 0 ;;
+ :) echo -e "\nERROR:option -$OPTARG requires an argument." >&2 ;
+ showhelp;
+ echo -e "\naborting.\n"
+ exit 1;;
+ \?) echo -e "\nERROR:invalid option: -$OPTARG";
+ showhelp;
+ echo -e "\naborting.\n"
+ exit 1 >&2 ;;
+ esac
+done
+
+#######find latest version in target repo. could use LATEST but would not know how to reflect version in file name
+
+
+version_regexp=".*\(.*\).*"
+
+
+if [ -z "$version" ]; then
+ version=`curl -silent -L "maven.research-infrastructures.eu/nexus/service/local/artifact/maven/resolve?r=$repo&g=$group&a=$artifact&v=LATEST&e=tar.gz&c=distro" \
+ | grep "$version_regexp" | sed "s|$version_regexp|\1|"` #(first extract matching line, then extract matching group)
+
+ if [ -z "$version" ]; then
+ echo -e "\nERROR: cannot find a version to download in $repo." >&2
+ echo -e "\naborting.\n"
+ exit 1
+ fi
+fi
+
+
+
+echo -e "\ndownloading common-smartgears-$version.tar.gz...\c"
+
+
+http_code=`curl -s -o "common-smartgears-$version.tar.gz" -w "%{http_code}" -L "maven.research-infrastructures.eu/nexus/service/local/artifact/maven/redirect?r=$repo&g=$group&a=$artifact&v=$version&e=tar.gz&c=distro"`
+
+if [ ! "$http_code" = "200" ]; then
+ echo -e "\n\nERROR: cannot download version $version from $repo." >&2
+ echo -e "\naborting.\n"
+ rm "common-smartgears-$version.tar.gz"
+ exit 1
+fi
+
+echo -e "done.\n"
\ No newline at end of file
diff --git a/distro/standalone.xml b/distro/standalone.xml
new file mode 100644
index 0000000..f5a86f6
--- /dev/null
+++ b/distro/standalone.xml
@@ -0,0 +1,52 @@
+
+ distro
+
+ tar.gz
+
+ ${artifact.artifactId}-${project.version}
+
+
+ scripts
+ ${distroDirectory}/contents/scripts
+ true
+
+ download
+
+ 755
+ true
+
+
+ ${distroDirectory}/contents
+ /
+ true
+
+ install
+ logback.xml
+
+ 755
+ true
+
+
+ libs
+ libs
+ true
+ 755
+
+
+ war
+ apps
+ true
+ 755
+
+
+
+
+
+ container.xml
+ true
+
+
+
\ No newline at end of file
diff --git a/distro/svnpath.txt b/distro/svnpath.txt
new file mode 100644
index 0000000..f416f9d
--- /dev/null
+++ b/distro/svnpath.txt
@@ -0,0 +1 @@
+${scm.url}
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..9e4e2dd
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,113 @@
+
+ 4.0.0
+
+ maven-parent
+ org.gcube.tools
+ 1.0.0
+
+ org.gcube.distribution
+ smartgears-distribution
+ 1.0.0-SNAPSHOT
+ pom
+ A distribution for the Smartgears Framework
+
+
+ distro
+
+
+
+ scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/${project.artifactId}
+ scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/${project.artifactId}
+ http://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/${project.artifactId}
+
+
+
+
+
+
+ org.gcube.distribution
+ maven-smartgears-bom
+ 1.0.0-SNAPSHOT
+ pom
+ import
+
+
+
+
+
+
+ org.gcube.core
+ common-smartgears
+
+
+ org.gcube.core
+ common-smartgears
+ 1.0.0-SNAPSHOT
+ probe
+ war
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.5.1
+
+
+ copy-dependencies
+ compile
+
+ copy-dependencies
+
+
+ ${basedir}/libs
+ false
+ false
+ true
+ war
+ true
+
+
+
+ copy-probe
+ compile
+
+ copy-dependencies
+
+
+ ${basedir}/war
+ false
+ false
+ true
+ war
+ true
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ standalone
+
+ false
+
+ ${distroDirectory}/standalone.xml
+
+
+ install
+
+ single
+
+
+
+
+
+
+
\ No newline at end of file