This commit is contained in:
Lucio Lelii 2010-11-08 19:02:22 +00:00
parent 18271f631c
commit cda4d2f4c0
12 changed files with 563 additions and 403 deletions

679
build.xml
View File

@ -1,15 +1,15 @@
<?xml version="1.0"?>
<!-- Ant buildfile for GCUBE Services
Version 0.5
REQUIRED INPUT PROPERTIES
<?xml version="1.0"?>
<!-- Ant buildfile for GCUBE Services
Version 0.5
INPUT PROPERTIES
This buildfile assumes that the following properties have or may have been defined in a "build.properties" file
in the configuration directory of the service (or else using the -D flag on the command line).
package: (mandatory) Root package of the service implementation: it should be the first package in the
implementation hierarchy which uniquely identifies the implementation.
implementation hierarchy which uniquely identifies the implementation.
lib.dir: (mandatory) Root directory where auxiliary jar files are located. Ideally outside ${base.dir} as not needed for remote build and dynamic deployment.
wsdl.<n>: (mandatory) Name of the <n>-th port-type of the service, as defined in the "name" attributed of the
"definitions" root element of the corresponding WSDL file.
@ -24,20 +24,23 @@ package.<n>: (optional) The package name of the stubs generated from WSDL and/
etics.build: (optional) Set to 'true', it indicates that build structures and procedures
should be optimised for remote builds in ETICS. If it is omitted, this buildfile will optimise build structures and procedures
for local builds.
full.stubs: (optional) Set to 'false', it excludes auxiliary stub code placed under ${package}/stubs when building the stub distribution.
It is intended to simplify realignment of auxiliary and standard stub in IDE environments in case the latter change in non backwards-compatible ways.
After re-alignment, the property is typically left to its default of 'true' to restore a joint build of all stub code.
-->
<project default="deployService" name="GCUBE Service Buildfile">
<!-- environment -->
<property environment="env" />
<!-- environment -->
<property environment="env" />
<!-- external environment -->
<echo message="container.dir ->${env.GLOBUS_LOCATION}" level="info"/>
<echo message="container.dir ->${env.GLOBUS_LOCATION}" level="info"/>
<property name="container.dir" value="${env.GLOBUS_LOCATION}" />
<property name="container.schema.dir" location="${container.dir}/share/schema" />
<property name="build.packages" location="${container.dir}/share/gcore_tools/build-packages.xml" />
<property name="build.stubs" location="${container.dir}/share/gcore_tools/build-stubs.xml" />
<property name="container.schema.dir" location="${container.dir}/share/schema" />
<property name="build.packages" location="${container.dir}/share/gcore_tools/build-packages.xml" />
<property name="build.stubs" location="${container.dir}/share/gcore_tools/build-stubs.xml" />
<!-- load non-standard tasks -->
<taskdef resource="ise/antelope/tasks/antlib.xml">
@ -63,7 +66,7 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<stringutil property="package.dir" string="${package}"><!-- derive package.dir from ${package} -->
<replace regex="\." replacement="/"/>
</stringutil>
</stringutil>
<!-- file defaults -->
<property name="garname" value="${package}"/>
@ -83,38 +86,39 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</if>
<property name="full.stubs" value="true"/>
<property name="stubs.package" value="${package}.${stubs.dir.name}"/>
<property name="stubs.dir.name" value="stubs" /> <!-- auxiliary stub classes -->
<property name="stubs.dir" value="${source.dir}/${package.dir}${stubs.dir.name}" />
<available file="${stubs.dir}" property="stubs.dir.present"/>
<!-- temporary build locations -->
<property name="build.dir" location="${build.location}/build" />
<property name="build.class.dir" location="${build.dir}/classes" />
<property name="build.lib.dir" location="${build.dir}/lib" />
<property name="build.schema.dir" location="${build.dir}/schema" />
<property name="build.schema.service.dir" location="${build.schema.dir}/${package}" />
<property name="build.stubs.dir" location="${build.dir}/stubs-${package}" />
<property name="build.stubs.src.dir" location="${build.stubs.dir}/src" />
<property name="build.stubs.class.dir" location="${build.stubs.dir}/classes" />
<!-- misc defaults -->
<property name="java.debug" value="on" />
<property name="java.deprecation" value="off" />
<!-- common filesets -->
<fileset dir="${build.lib.dir}" id="garjars" />
<property name="garjars.id" value="garjars" />
<fileset dir="${build.schema.dir}" id="garschema">
<include name="${package}/**" />
</fileset>
<property name="garschema.id" value="garschema" />
<fileset dir="${etc.dir}" id="garetc" />
<property name="garetc.id" value="garetc" />
<!-- initialisation tasks -->
<target name="init" depends="clean" description="creates build structures">
<property name="stubs.dir.name" value="stubs" /> <!-- auxiliary stub classes -->
<property name="stubs.dir" value="${source.dir}/${package.dir}/${stubs.dir.name}" />
<available file="${stubs.dir}" property="stubs.dir.present"/>
<!-- temporary build locations -->
<property name="build.dir" location="${build.location}/build" />
<property name="build.class.dir" location="${build.dir}/classes" />
<property name="build.lib.dir" location="${build.dir}/lib" />
<property name="build.schema.dir" location="${build.dir}/schema" />
<property name="build.schema.service.dir" location="${build.schema.dir}/${package}" />
<property name="build.stubs.dir" location="${build.dir}/stubs-${package}" />
<property name="build.stubs.src.dir" location="${build.stubs.dir}/src" />
<property name="build.stubs.class.dir" location="${build.stubs.dir}/classes" />
<!-- misc defaults -->
<property name="java.debug" value="on" />
<property name="java.deprecation" value="off" />
<!-- common filesets -->
<fileset dir="${build.lib.dir}" id="garjars" />
<property name="garjars.id" value="garjars" />
<fileset dir="${build.schema.dir}" id="garschema">
<include name="${package}/**" />
</fileset>
<property name="garschema.id" value="garschema" />
<fileset dir="${etc.dir}" id="garetc" />
<property name="garetc.id" value="garetc" />
<!-- initialisation tasks -->
<target name="init" depends="clean" description="creates build structures">
<!-- input summary -->
<echo message="Root Package -> ${package}" level="info"/>
@ -131,163 +135,169 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<!-- create dependency location, if it does not exist already -->
<mkdir dir="${lib.location}" />
<!-- create temporary build folders -->
<mkdir dir="${build.dir}" />
<mkdir dir="${build.class.dir}" />
<delete dir="${build.lib.dir}" />
<mkdir dir="${build.lib.dir}" />
<mkdir dir="${build.schema.service.dir}" />
<mkdir dir="${build.stubs.dir}" />
<mkdir dir="${build.stubs.src.dir}" />
<mkdir dir="${build.stubs.class.dir}"/>
<!-- Populates schema folder -->
<copy toDir="${build.schema.dir}">
<fileset dir="${container.schema.dir}" casesensitive="yes">
<include name="wsrf/**/*" />
<include name="ws/**/*" />
<include name="gcube/**/**/**/*" />
</fileset>
</copy>
<copy toDir="${build.schema.service.dir}">
<fileset dir="${schema.dir}"/>
<!-- create temporary build folders -->
<mkdir dir="${build.dir}" />
<mkdir dir="${build.class.dir}" />
<delete dir="${build.lib.dir}" />
<mkdir dir="${build.lib.dir}" />
<mkdir dir="${build.schema.service.dir}" />
<mkdir dir="${build.stubs.dir}" />
<mkdir dir="${build.stubs.src.dir}" />
<mkdir dir="${build.stubs.class.dir}"/>
<!-- Populates schema folder -->
<copy toDir="${build.schema.dir}">
<fileset dir="${container.schema.dir}" casesensitive="yes">
<include name="wsrf/**/*" />
<include name="ws/**/*" />
<include name="gcube/**/**/**/*" />
</fileset>
</copy>
<copy toDir="${build.schema.service.dir}">
<fileset dir="${schema.dir}"/>
</copy>
</target>
<!-- wsdl specific tasks. Clone for each additional wsdl, if required -->
<target name="processWSDL.1" depends="init" if="wsdl.1" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.1}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.1}.wsdl" />
<property name="wsdl.target" value="${wsdl.1}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.1}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.1}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.1}" />
</ant>
</target>
<target name="processWSDL.2" depends="init" if="wsdl.2" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.2}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.2}.wsdl" />
<property name="wsdl.target" value="${wsdl.2}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.2}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.2}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.2}" />
</ant>
</target>
<target name="processWSDL.3" depends="init" if="wsdl.3" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.3}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.3}.wsdl" />
<property name="wsdl.target" value="${wsdl.3}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.3}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.3}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.3}" />
</ant>
</target>
<target name="processWSDL.4" depends="init" if="wsdl.4" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.4.name}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.4}.wsdl" />
<property name="wsdl.target" value="${wsdl.4}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.4}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.4}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.4}" />
</ant>
</target>
<target name="processWSDL.5" depends="init" if="wsdl.5" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.5}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.5}.wsdl" />
<property name="wsdl.target" value="${wsdl.5}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.5}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.5}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.5}" />
</ant>
</target>
<!-- Populates library folder -->
<copy toDir="${build.lib.dir}">
<fileset dir="${lib.location}">
<exclude name="${jarfile.stubs}" />
</fileset>
</copy>
<target name="processWSDL.6" depends="init" if="wsdl.6" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.6}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.6}.wsdl" />
<property name="wsdl.target" value="${wsdl.6}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.6}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.6}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.6}" />
</ant>
</target>
<!-- wsdl specific tasks. Clone for each additional wsdl, if required -->
<target name="processWSDL.1" depends="init" if="wsdl.1" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.1}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.1}.wsdl" />
<property name="wsdl.target" value="${wsdl.1}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.1}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.1}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.1}" />
</ant>
</target>
<target name="processWSDL.2" depends="init" if="wsdl.2" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.2}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.2}.wsdl" />
<property name="wsdl.target" value="${wsdl.2}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.2}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.2}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.2}" />
</ant>
</target>
<target name="processWSDL.3" depends="init" if="wsdl.3" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.3}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.3}.wsdl" />
<property name="wsdl.target" value="${wsdl.3}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.3}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.3}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.3}" />
</ant>
</target>
<target name="processWSDL.4" depends="init" if="wsdl.4" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.4.name}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.4}.wsdl" />
<property name="wsdl.target" value="${wsdl.4}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.4}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.4}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.4}" />
</ant>
</target>
<target name="processWSDL.5" depends="init" if="wsdl.5" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.5}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.5}.wsdl" />
<property name="wsdl.target" value="${wsdl.5}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.5}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.5}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.5}" />
</ant>
</target>
<target name="processWSDL.6" depends="init" if="wsdl.6" description="Flattens wsdl and generate bindings">
<echo message="PROCESSING ${wsdl.6}'s WSDL:" level="debug"/>
<ant antfile="${build.stubs}" target="flatten">
<property name="source.flatten.dir" location="${build.schema.service.dir}" />
<property name="target.flatten.dir" location="${build.schema.service.dir}" />
<property name="wsdl.source" value="${wsdl.6}.wsdl" />
<property name="wsdl.target" value="${wsdl.6}_flattened.wsdl" />
<property name="wsdl.porttype" value="${wsdl.6}PortType" />
</ant>
<ant antfile="${build.stubs}" target="generateBinding">
<property name="source.binding.dir" value="${build.schema.service.dir}" />
<property name="target.binding.dir" value="${build.schema.service.dir}" />
<property name="porttype.wsdl" value="${wsdl.6}_flattened.wsdl" />
<property name="binding.root" value="${wsdl.6}" />
</ant>
</target>
<target name="generateStubs.1" if="wsdl.1" description="Generate wsdl stub classes">
<echo message="GENERATING ${wsdl.1}'s STUBS:" level="debug"/>
<ant antfile="${build.stubs}" target="generateStubs">
<property name="mappings" value="${mappings}"/>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.1}_service.wsdl" />
</ant>
</target>
<target name="generateStubs.2" if="wsdl.2" description="Generate wsdl stub classes">
<echo message="GENERATING ${wsdl.2}'s STUBS:" level="debug"/>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.1}_service.wsdl" />
</ant>
</target>
<target name="generateStubs.2" if="wsdl.2" description="Generate wsdl stub classes">
<echo message="GENERATING ${wsdl.2}'s STUBS:" level="debug"/>
<ant antfile="${build.stubs}" target="generateStubs">
<property name="mappings" value="${mappings}"/>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.2}_service.wsdl" />
</ant>
</target>
<target name="generateStubs.3" if="wsdl.3" description="Generate wsdl stub classes">
<echo message="GENERATING ${wsdl.3}'s STUBS:" level="debug"/>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.2}_service.wsdl" />
</ant>
</target>
<target name="generateStubs.3" if="wsdl.3" description="Generate wsdl stub classes">
<echo message="GENERATING ${wsdl.3}'s STUBS:" level="debug"/>
<ant antfile="${build.stubs}" target="generateStubs">
<property name="mappings" value="${mappings}"/>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.3}_service.wsdl" />
</ant>
</target>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.3}_service.wsdl" />
</ant>
</target>
<target name="generateStubs.4" if="wsdl.4" description="Generate wsdl stub classes">
<echo message="GENERATING ${wsdl.4}'s STUBS:" level="debug"/>
@ -295,7 +305,7 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<property name="mappings" value="${mappings}"/>
<property name="source.stubs.dir" location="${build.schema.service.dir}" />
<property name="target.stubs.dir" location="${build.stubs.src.dir}" />
<property name="wsdl.file" value="${wsdl.4}_service.wsdl" />
<property name="wsdl.file" value="${wsdl.4}_service.wsdl" />
</ant>
</target>
@ -318,10 +328,10 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<property name="wsdl.file" value="${wsdl.6}_service.wsdl" />
</ant>
</target>
<!-- Cross-wsdl tasks. Adds dependencies for each additional wsdl, if required -->
<target name="processWSDLs" depends="processWSDL.1,processWSDL.2,processWSDL.3,processWSDL.4,processWSDL.5,processWSDL.6" description="generate bindings for all porttypes" />
<target name="generateStubs" depends="generateMappings,generateStubs.1,generateStubs.2,generateStubs.3,generateStubs.4,generateStubs.5,generateStubs.6" description="generate stub classes for all porttypes" />
<!-- Cross-wsdl tasks. Adds dependencies for each additional wsdl, if required -->
<target name="processWSDLs" depends="processWSDL.1,processWSDL.2,processWSDL.3,processWSDL.4,processWSDL.5,processWSDL.6" description="generate bindings for all porttypes" />
<target name="generateStubs" depends="generateMappings,generateStubs.1,generateStubs.2,generateStubs.3,generateStubs.4,generateStubs.5,generateStubs.6" description="generate stub classes for all porttypes" />
<target name="generateMappings">
<var name="mappings" value=""/>
@ -373,8 +383,15 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
</if>
<var name="mappings" value="${mappings} -N${namespace.6}=${package.6} -N${namespace.6}/service=${package.6}.service -N${namespace.6}/bindings=${package.6}.bindings"/>
</if>
<var name="mappings" value="${mappings} -Nhttp://gcube-system.org/namespaces/common=org.gcube.common"/>
<!-- ADD LATER TO
<var name="mappings" value="${mappings} -x http://gcube-system.org/namespaces/common"/>
-->
</target>
<!-- Service tasks -->
@ -383,9 +400,10 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<arg value="${gar.location}/${package}.gar"/>
</exec>
</target>
<target name="buildService" depends="processWSDLs" description="compiles service implementation">
<javac srcdir="${source.dir}" destdir="${build.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}">
<javac srcdir="${source.dir}" destdir="${build.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}"> <exclude name="${package.dir}/${stubs.dir.name}/**"/>
<exclude name="${stubs.dir}/**"/>
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
@ -395,136 +413,163 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
<exclude name="${jarfile}" />
</fileset>
</classpath>
</javac>
</target>
<target name="jarService" depends="buildService" description="jars service implementation">
<copy todir="${build.class.dir}">
<fileset dir="${source.dir}">
<include name="org/**/*.xsl"/>
<include name="org/**/*.xsd"/>
</fileset>
</copy>
<jar jarfile="${build.lib.dir}/${jarfile}" basedir="${build.class.dir}">
<include name="${package.dir}/**" />
</jar>
</target>
<target name="garService" depends="jarService" description="creates service gar">
<ant antfile="${build.packages}" target="makeGar">
<property name="garserverdeployment.file" value="${etc.dir}/deploy-server.wsdd" />
<property name="garserverdeployment_NOSEC.file" value="${etc.dir}/deploy-server.wsdd_NOSEC" />
<property name="garclientdeployment.file" value="${etc.dir}/deploy-client.wsdd" />
<property name="garclientserverdeployment.file" value="${etc.dir}/deploy-client-server.wsdd" />
<property name="garjndiconfigdeployment.file" value="${etc.dir}/deploy-jndi-config.xml" />
<property name="gar.id" value="${package}" />
<reference refid="${garjars.id}" />
<reference refid="${garschema.id}" />
<reference refid="${garetc.id}" />
</ant>
</javac>
</target>
<target name="jarService" depends="buildService" description="jars service implementation">
<copy todir="${build.class.dir}">
<fileset dir="${source.dir}">
<include name="org/**/*.xsd"/>
<include name="org/**/*.xml"/>
<include name="org/**/*.properties"/>
</fileset>
</copy>
<jar jarfile="${build.lib.dir}/${jarfile}" basedir="${build.class.dir}">
<include name="${package.dir}/**" />
</jar>
</target>
<target name="garService" depends="jarService" description="creates service gar">
<ant antfile="${build.packages}" target="makeGar">
<property name="garserverdeployment.file" value="${etc.dir}/deploy-server.wsdd" />
<property name="garserverdeployment_NOSEC.file" value="${etc.dir}/deploy-server.wsdd_NOSEC" />
<property name="garclientdeployment.file" value="${etc.dir}/deploy-client.wsdd" />
<property name="garclientserverdeployment.file" value="${etc.dir}/deploy-client-server.wsdd" />
<property name="garjndiconfigdeployment.file" value="${etc.dir}/deploy-jndi-config.xml" />
<property name="gar.id" value="${package}" />
<reference refid="${garjars.id}" />
<reference refid="${garschema.id}" />
<reference refid="${garetc.id}" />
</ant>
<delete dir="tmp" />
<move file="${garfile}" toDir="${gar.location}"/>
</target>
<!-- Stub Build tasks -->
<move file="${garfile}" toDir="${gar.location}"/>
</target>
<!-- Stub Build tasks -->
<target name="buildStubs" depends="processWSDLs,generateStubs" description="build service stubs">
<if name="stubs.dir.present">
<copy toDir="${build.stubs.src.dir}/${package.dir}/${stubs.dir.name}" overwrite="true">
<fileset dir="${stubs.dir}" casesensitive="yes">
<exclude name="**/*.class" />
</fileset>
</copy>
</if>
<javac srcdir="${build.stubs.src.dir}" destdir="${build.stubs.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}" description="compile stub classes">
<include name="**/*.java" />
<classpath>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
<exclude name="${jarfile.stubs}" />
<exclude name="${jarfile}" />
<if name="full.stubs" value="true">
<if name="stubs.dir.present">
<copy toDir="${build.stubs.src.dir}/${package.dir}/${stubs.dir.name}" overwrite="true">
<fileset dir="${stubs.dir}" casesensitive="yes">
<exclude name="**/*.class" />
</fileset>
</copy>
</if>
</if>
<javac srcdir="${build.stubs.src.dir}" destdir="${build.stubs.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}" description="compile stub classes">
<include name="**/*.java" />
<classpath>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
<exclude name="${jarfile.stubs}" />
<exclude name="${jarfile}" />
</fileset>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile.stubs}" />
<exclude name="**/${jarfile}" />
</fileset>
</classpath>
</fileset>
</classpath>
</javac>
<copy toDir="${build.stubs.class.dir}/META-INF" overwrite="false"><!-- copy configuration info as well -->
</target>
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
<copy toDir="${build.stubs.class.dir}/META-INF">
<fileset dir="${etc.dir}" casesensitive="yes" />
</copy>
</target>
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
<jar destfile="${build.lib.dir}/${jarfile.stubs}" basedir="${build.stubs.class.dir}" />
</target>
<copy todir="${build.stubs.class.dir}">
<fileset dir="${source.dir}">
<include name="org/**/*.xsd"/>
<include name="org/**/*.properties"/>
</fileset>
</copy>
<jar destfile="${build.lib.dir}/${jarfile.stubs}" basedir="${build.stubs.class.dir}" />
</target>
<target name="deployStubs" depends="jarStubs" description="deploy stub jar">
<copy file="${build.lib.dir}/${jarfile.stubs}" toDir="${lib.location}"/>
<if name="etics.build" value="false">
<copy file="${build.lib.dir}/${jarfile.stubs}" toDir="${container.dir}/lib"/>
</if>
</if>
</target>
<target name="stubs" depends="deployStubs" description="generates, builds, jars and deploy stubs"/>
<!-- undeployement tasks -->
<target name="undeployStubs" description="deploy stub jar">
<delete file="${container.dir}/lib/${jarfile.stubs}"/>
</target>
<target name="undeployService" description="undeploy service jar">
<exec executable="${container.dir}/bin/gcore-undeploy-service">
<arg value="${package}"/>
</exec>
</target>
<!-- javadoc tasks -->
<target name="doc">
<javadoc access="public" author="true" sourcepath="${source.dir}" packagenames="${package}.*"
destdir="doc/api" nodeprecated="false" nodeprecatedlist="false"
noindex="false" nonavbar="false" notree="false"
source="1.5"
splitindex="true"
use="true" version="true" failonerror="false">
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile}" />
</fileset>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</javadoc>
</target>
<target name="docstubs">
<javadoc access="public" author="true" destdir="doc/api" nodeprecated="false"
packagenames="${package}.${stubs.dir.name}.*"
nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false"
source="1.5" sourcepath="${build.stubs.src.dir}"
splitindex="true" use="true" version="true"
failonerror="false">
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile.stubs}" />
</fileset>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</javadoc>
</target>
<target name="clean">
<target name="stubs" depends="deployStubs" description="generates, builds, jars and deploy stubs"/>
<!-- undeployement tasks -->
<target name="undeployStubs" description="deploy stub jar">
<delete file="${container.dir}/lib/${jarfile.stubs}"/>
</target>
<target name="undeployService" description="undeploy service jar">
<exec executable="${container.dir}/bin/gcore-undeploy-service">
<arg value="${package}"/>
</exec>
</target>
<!-- javadoc tasks -->
<target name="doc">
<javadoc access="public" author="true" sourcepath="${source.dir}" packagenames="${package}.*"
destdir="doc/api" nodeprecated="false" nodeprecatedlist="false"
noindex="false" nonavbar="false" notree="false"
source="1.5"
splitindex="true"
use="true" version="true" failonerror="false">
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile}" />
</fileset>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</javadoc>
</target>
<target name="docstubs">
<javadoc access="public" author="true" destdir="doc/api" nodeprecated="false"
packagenames="${package}.${stubs.dir.name}.*"
nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false"
source="1.5" sourcepath="${build.stubs.src.dir}"
splitindex="true" use="true" version="true"
failonerror="false">
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile.stubs}" />
</fileset>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</javadoc>
</target>
<target name="doctests">
<javadoc access="public" author="true" destdir="doc/api" nodeprecated="false"
packagenames="${package}.${stubs.dir.name}.test/*"
nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false"
source="1.5" sourcepath="${build.stubs.src.dir}"
splitindex="true" use="true" version="true"
failonerror="false">
<classpath>
<fileset dir="${lib.location}">
<include name="**/*.jar" />
<exclude name="**/${jarfile.stubs}" />
</fileset>
<fileset dir="${container.dir}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</javadoc>
</target>
<target name="clean">
<delete dir="${build.dir}" quiet="true"/>
<delete dir="${service.dir}/tmp" quiet="true"/>
<delete file="${gar.location}/${garfile}" quiet="true"/>
</target>
</project>
<delete file="${gar.location}/${garfile}" quiet="true"/>
</target>
</project>

View File

@ -142,6 +142,10 @@
<xsd:element name="setCloudVMsRequestMessage" type="xsd:int"/>
<xsd:element name="getCloudVMsResponseMessage" type="xsd:int"/>
<xsd:element name="getCloudVMsRequestMessage" type="coretypes:VOID"/>
<xsd:element name="isUseCloudResponseMessage" type="xsd:boolean"/>
<xsd:element name="isUseCloudRequestMessage" type="coretypes:VOID"/>
@ -240,6 +244,13 @@
<part name="response" element="tns:setCloudVMsResponseMessage"/>
</message>
<message name="GetCloudVMsInputMessage">
<part name="request" element="tns:getCloudVMsRequestMessage"/>
</message>
<message name="GetCloudVMsOutputMessage">
<part name="response" element="tns:getCloudVMsResponseMessage"/>
</message>
<message name="IsUseCloudInputMessage">
<part name="request" element="tns:isUseCloudRequestMessage"/>
</message>
@ -355,6 +366,11 @@
<output message="tns:SetCloudVMsOutputMessage"/>
</operation>
<operation name="getCloudVMs">
<input message="tns:GetCloudVMsInputMessage"/>
<output message="tns:GetCloudVMsOutputMessage"/>
</operation>
<operation name="isUseCloud">
<input message="tns:IsUseCloudInputMessage"/>
<output message="tns:IsUseCloudOutputMessage"/>

View File

@ -38,7 +38,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
logger.info("notification received for genericResource "+id+" and operation "+operation);
if (id.compareTo(this.functionalityResourceId)==0 && (operation.compareTo("update")==0)){
if ((operation.compareTo("update")==0) && id.compareTo(this.functionalityResourceId)==0){
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
resource.load(new StringReader(profile));
@ -54,6 +54,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
FunctionalityHandler functionalityHandler= new FunctionalityHandler();
KGCUBEGenericFunctionalityResource functResource=new KGCUBEGenericFunctionalityResource();
functResource.load(new StringReader(profile));
this.functionalityResourceId=functResource.getID();
functionalityHandler.add(functResource);
} else
if (ServiceContext.getContext().getSecondaryTypeGenericResourceRequired().contains(genericResource.getSecondaryType()))

View File

@ -10,18 +10,20 @@ import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ModelerResource>{
protected void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
protected synchronized void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
super.onLoad(resource, ois);
resource.setId((String)ois.readObject());
resource.setDeployReport((DeployReport)ois.readObject());
resource.setUseCloud(ois.readBoolean());
if (resource.isUseCloud())resource.setNumberOfVMsForCloud(ois.readInt());
}
protected void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
protected synchronized void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
super.onStore(resource, oos);
oos.writeObject(resource.getId());
oos.writeObject(resource.getDeployReport());
oos.writeBoolean(resource.isUseCloud());
if (resource.isUseCloud())oos.writeInt(resource.getNumberOfVMsForCloud());
}
}

View File

@ -23,6 +23,7 @@ public class ModelerResource extends GCUBEWSResource {
this.setId((String) args[0]);
this.deployReport=null;
this.isUseCloud=false;
this.numberOfVMsForCloud=-1;
}

View File

@ -98,11 +98,6 @@ public class ModelerService {
*/
public GHNList getGHNs(VOID var) throws GCUBEFault{
logger.trace("getGHNs method");
try {
if (getResource().isUseCloud()) throw new GCUBEFault("deply on cloud is selected, the ghns cannot be returned");
} catch (ResourceException e1) {
throw new GCUBEFault(e1);
}
ResultSet res;
ArrayList<String> relatedGHN=new ArrayList<String>();
try{
@ -511,10 +506,21 @@ public class ModelerService {
getResource().store();
}
public boolean isUseCloud() throws Exception{
/**
*
* @param r VOID
* @return
* @throws Exception
*/
public boolean isUseCloud(VOID r) throws Exception{
return getResource().isUseCloud();
}
/**
*
* @param numberOfVMs
* @throws Exception
*/
public void setCloudVMs(int numberOfVMs) throws Exception{
ModelerResource resource = getResource();
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be set, you are not using cloud deployement");
@ -522,4 +528,16 @@ public class ModelerService {
resource.store();
}
/**
*
* @param r VOID
* @return
* @throws Exception
*/
public int getCloudVMs(VOID r) throws Exception{
ModelerResource resource = getResource();
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be returned, you are not using cloud deployement");
return resource.getNumberOfVMsForCloud();
}
}

View File

@ -62,6 +62,7 @@ public class ServiceContext extends GCUBEServiceContext{
ISNotifier notifier= GHNContext.getImplementation(ISNotifier.class);
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
if (scope.isInfrastructure()) continue;
ServiceContext.getContext().setScope(scope);
ArrayList<String> genResList= new ArrayList<String>();

View File

@ -3,7 +3,6 @@ package org.gcube.vremanagement.vremodeler.impl.deploy;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.java.dev.jaxb.array.StringArray;
import org.apache.axis.client.Call;
@ -15,6 +14,7 @@ import org.gcube.vremanagement.vremodeler.stubs.deployreport.GHNonCloudReport;
import org.gcube.vremanagement.vremodeler.stubs.deployreport.State;
import org.uoa.eolus.Eolus;
import org.uoa.eolus.EolusServiceLocator;
import org.uoa.eolus.startContainer;
public class DeployGHNsOnCloud{
@ -52,11 +52,10 @@ public class DeployGHNsOnCloud{
((Stub) eolus)._setProperty(Call.USERNAME_PROPERTY, username);
((Stub) eolus)._setProperty(Call.PASSWORD_PROPERTY, password);
//filling the report
List<State> ghnsStates=new ArrayList<State>(numberOfVMs);
Collections.fill(ghnsStates, State.Running);
this.report.setDeployingState(ghnsStates);
report.setDeployingState(new State[numberOfVMs]);
Arrays.fill(report.getDeployingState(), State.Waiting);
VM[] hostnames=createVMs(eolus);
configureAndStartContainers(eolus, hostnames);
@ -81,38 +80,51 @@ public class DeployGHNsOnCloud{
StringArray vnets = new StringArray();
vnets.setItem(nets);
//TODO: change this code
//TODO: change this code to support more VMs templates
String template=eolus.getTemplates().getItem()[0];
logger.trace("got the template: "+template);
VM[] vmsNames= new VM[numberOfVMs];
//the first VM will be set with limited resource (1Gb of ram) for the RM
eolus.createVM(template, vreName+"ResourceManager", 2, 1024, vnets);
vmsNames[0]= new VM(vreName+"ResourceManager");
logger.trace("creating the first VM for ResourceManager "+vreName+"ResourceManager");
report.getDeployingState()[0]=State.Running;
//the others VMs will be created with 2 GB of ram
for (int i=1; i<numberOfVMs; i++){
eolus.createVM(template, vreName+i, 2, 2048, vnets);
vmsNames[i]= new VM(vreName+"ResourceManager");
vmsNames[i]= new VM(vreName+i);
report.getDeployingState()[i]=State.Running;
logger.trace("creating the VM"+i+" "+ vreName+i);
}
//waiting few seconds
Thread.sleep(10000);
logger.trace("checking the VMs Availability");
//waiting few seconds
Thread.sleep(30000);
//check if the VMs are ready
boolean[] arrayCheck= new boolean[numberOfVMs];
Arrays.fill(arrayCheck, false);
while (!and(arrayCheck)){
//waiting few seconds
Thread.sleep(30000);
//TODO: this cycle cannot continue forever
for (int i=0; i<numberOfVMs; i++){
try{
if (arrayCheck[i]) continue;
if(eolus.getVMStatus(vmsNames[i].getName()).equalsIgnoreCase("running")){
String vmState= eolus.getVMStatus(vmsNames[i].getName());
if(vmState.equalsIgnoreCase("running")){
arrayCheck[i]=true;
vmsNames[i].setIp(eolus.getVMIP(vmsNames[i].getName()));
}
//report.getDeployingState().set(i, State.Finished);
logger.trace("the VM "+vmsNames[i].getName()+" is RUNNING with ip "+vmsNames[i].getIp());
}
//else if(!vmState.equalsIgnoreCase("staging"));
}catch (Exception e) {
//if one fails i cannot continue
logger.error("error deploying "+vmsNames[i].getName());
report.getDeployingState().set(i, State.Failed);
logger.error("error deploying "+vmsNames[i].getName(),e);
report.getDeployingState()[i]=State.Failed;
throw e;
}
}
@ -124,26 +136,44 @@ public class DeployGHNsOnCloud{
private void configureAndStartContainers(Eolus eolus, VM[] hostnames) throws Exception {
String[] scopes=ServiceContext.getContext().getScope().toString().split("/");
String cmdtorun = "configureGHN.sh "+scopes[1]+" "+scopes[2];
logger.trace("configuring ghns with command "+cmdtorun);
String[] res;
for (int i=1; i<hostnames.length; i++){
for (int i=0; i<hostnames.length; i++){
res = eolus.execCMD(cmdtorun, hostnames[i].getName()).getItem();
if (res.length > 2)
this.report.getDeployingState().set(i, State.Failed);
logger.trace("configuring the GHN on host for VM "+hostnames[i].getName()+" got the following report:");
logger.trace("std output "+res[0]);
//terrible... waiting for enhancement
if (res.length > 2) {
this.report.getDeployingState()[i]= State.Failed;
logger.trace("std error "+res[1]);
}
}
//waiting few seconds before start the container
Thread.sleep(60000);
//starting the containers
for (int i=0; i<hostnames.length; i++){
Thread startcontainerthread = new startContainer(eolus,hostnames[i].getName());
startcontainerthread.start();
}
}
private void checkGHNAvailability(VM[] hostnames) throws Exception{
boolean[] arrayCheck= new boolean[hostnames.length];
Arrays.fill(arrayCheck, false);
while (!and(arrayCheck)){
logger.trace("checking published GHNs");
Thread.sleep(40000);
ResultSet queryRes;
for (int i=0; i<hostnames.length; i++){
if (arrayCheck[i]) continue;
queryRes= DBInterface.queryDB("select id from ghn where host='"+hostnames[i].getIp()+"'");
queryRes= DBInterface.queryDB("select id from ghn where host LIKE '"+hostnames[i].getIp()+"%'");
if (queryRes.next()) {
hostnames[i].setGhnId(queryRes.getString(1));
logger.trace("the host "+hostnames[i].getName()+" has been retrieved with ghn id "+hostnames[i].getGhnId());
arrayCheck[i]=true;
this.report.getDeployingState().set(i, State.Finished);
this.report.getDeployingState()[i]= State.Finished;
DBInterface.ExecuteUpdate("update GHN set isoncloud='true' where id='"+hostnames[i].getGhnId()+"'");
}
}
@ -165,34 +195,65 @@ public class DeployGHNsOnCloud{
private String ip;
private String name;
private String ghnId;
/**
*
* @param name
*/
public VM(String name) {
super();
this.ip=null;
this.ghnId=null;
this.name = name;
}
/**
*
* @return the ip
*/
public String getIp() {
return ip;
}
/**
*
* @param ip the VM's ip
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
*
* @return the VM name
*/
public String getName() {
return name;
}
/**
*
* @param name the VM name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* @return the ghn ID
*/
public String getGhnId() {
return ghnId;
}
/**
*
* @param ghnId
*/
public void setGhnId(String ghnId) {
this.ghnId = ghnId;
}
}
}

View File

@ -62,19 +62,18 @@ public class DeployVRE extends Thread{
private GCUBEScope startingScope;
private String vreName=null;
private CollectionResourceCreation collectionResourceCreation;
private DeployReport report;
public DeployVRE(String resourceId, GCUBEScope scope) throws GCUBEFault, Exception{
this.resourceId=resourceId;
this.startingScope= scope;
this.report= new DeployReport();
try{
ResultSet resGenericInfo = DBInterface.queryDB("select VRE.name from VRE where VRE.id='"+this.resourceId+"'; ");
if (!resGenericInfo.next()) {
throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved on the DB");
}
vreName= resGenericInfo.getString(1);
System.out.println(vreName);
}catch (Exception e) {
logger.error("error retrieving the VRE Name",e);
throw e;
@ -91,6 +90,8 @@ public class DeployVRE extends Thread{
*/
public void run(){
try {
getResource().setDeployReport(new DeployReport());
//reports initialization
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
@ -98,15 +99,16 @@ public class DeployVRE extends Thread{
GHNstoUse ghnsToUse=null;
if (getResource().isUseCloud()){
DeployGHNsOnCloud ghnOnCloud = new DeployGHNsOnCloud(getResource().getNumberOfVMsForCloud(), vreName);
this.report.setCloudDeployingReport(ghnOnCloud.getReport());
getResource().getDeployReport().setCloudDeployingReport(ghnOnCloud.getReport());
try{
ghnsToUse = ghnOnCloud.run();
}catch (Exception e) {
logger.error("error creating VMs on cloud",e);
this.report.getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
getResource().getDeployReport().getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
throw new Exception("error creating VMs on cloud",e);
}
}else {
this.report.getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Skipped);
getResource().getDeployReport().getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Skipped);
ResultSet resRelatedGHN=DBInterface.queryDB("select VRERELATEDGHN.ghnid, GHN.domain, VRERELATEDGHN.ISCANDIDATE from VRERELATEDGHN, GHN where GHN.id=VRERELATEDGHN.ghnid and VRERELATEDGHN.vreid='"+this.resourceId+"' ORDER BY GHN.host; ");
ghnsToUse = new GHNstoUse();
while (resRelatedGHN.next()) {
@ -116,9 +118,9 @@ public class DeployVRE extends Thread{
}
}
if (!deployManagerOnVRE(ghnsToUse.candidateForRM)){
if (deployManagerOnVRE(ghnsToUse.candidateForRM)){
if (!createVRE(ghnsToUse.getGhns())){
if (createVRE(ghnsToUse.getGhns())){
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished+"' WHERE VRE.id='"+this.resourceId+"';");
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
getResource().store();
@ -151,7 +153,6 @@ public class DeployVRE extends Thread{
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{
String vreName= null;
try {
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
} catch (Exception e) {
@ -188,7 +189,9 @@ public class DeployVRE extends Thread{
arp.setServices(services);
arp.setTargetScope(this.scope+"/"+vreName);
String reportId=resourceManagerPT.addResources(arp);
logger.trace("the report id for Rm is "+reportId);
//waiting few seconds
Thread.currentThread().sleep(60000);
int attempt=0;
do{
Thread.currentThread().sleep(20000);
@ -198,10 +201,10 @@ public class DeployVRE extends Thread{
getResource().store();
}while (!isDeploymentStatusFinished(report) && attempt<10);
}catch(Exception e){e.printStackTrace(); throw e;}
}catch(Exception e){logger.error("error deploying RM on VRE",e); throw e;}
logger.trace("report step 1: "+report);
logger.info("is something failed in the first step?"+isSomethingFailed(report));
return isSomethingFailed(report);
return !isSomethingFailed(report);
}
};
@ -218,7 +221,6 @@ public class DeployVRE extends Thread{
logger.error("DeployingVRE step 1 -- failed "+e);
return false;
}
this.vreName= vreName;
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
getResource().store();
@ -293,7 +295,9 @@ public class DeployVRE extends Thread{
String report=null;
String reportId=rmPortType.createScope(scopeParameter);
logger.trace("the report id for Rm is "+reportId);
int reportAttempt=0;
do{
try{
@ -309,7 +313,7 @@ public class DeployVRE extends Thread{
logger.info("is something failed in the second step?"+isSomethingFailed(report));
logger.trace("report step 2: "+report);
return isSomethingFailed(report);
return !isSomethingFailed(report);
}

View File

@ -33,6 +33,8 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
}
private void insert(GCUBEHostingNode ghn) throws Exception {
//GHN(ID VARCHAR NOT NULL PRIMARY KEY,HOST VARCHAR,SECURITY VARCHAR,UPTIME VARCHAR,MAINMEMORYVA VARCHAR,MAINMEMORYVS VARCHAR,LOCALAS VARCHAR,LOCATION VARCHAR,COUNTRY VARCHAR,DOMAIN VARCHAR, ISONCLOUD BOOLEAN)
ArrayList<String> row= new ArrayList<String>(10);
String id= ghn.getID();
row.add(id);

View File

@ -1,9 +1,6 @@
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class GHNonCloudReport implements Serializable {
/**
@ -13,11 +10,10 @@ public class GHNonCloudReport implements Serializable {
private State state;
private List<State> deployingState= new ArrayList<State>();
private State[] deployingState;
public GHNonCloudReport() {
this.state= State.Waiting;
Collections.fill(this.deployingState, State.Waiting);
}
@ -29,11 +25,11 @@ public class GHNonCloudReport implements Serializable {
this.state = state;
}
public List<State> getDeployingState() {
public State[] getDeployingState() {
return deployingState;
}
public void setDeployingState(List<State> deployingState) {
public void setDeployingState(State[] deployingState) {
this.deployingState = deployingState;
}
}

View File

@ -1,22 +1,17 @@
package org.gcube.vremanagement.vremodeler.test;
import java.util.Date;
import java.util.List;
import java.util.Calendar;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.apache.axis.types.URI;
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.AtomicCondition;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.types.VOID;
import org.gcube.vremanagement.vremodeler.stubs.CollectionArray;
import org.gcube.vremanagement.vremodeler.stubs.CollectionList;
import org.gcube.vremanagement.vremodeler.stubs.FunctionalityIDArray;
import org.gcube.vremanagement.vremodeler.stubs.GHNArray;
import org.gcube.vremanagement.vremodeler.stubs.ModelerFactoryPortType;
import org.gcube.vremanagement.vremodeler.stubs.ModelerServicePortType;
import org.gcube.vremanagement.vremodeler.stubs.VREDescription;
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerFactoryServiceAddressingLocator;
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerServiceAddressingLocator;
@ -31,10 +26,11 @@ public class ModelerTest {
GCUBERIQuery riquery= client.getQuery(GCUBERIQuery.class);
riquery.addAtomicConditions(new AtomicCondition("//ServiceName", "VREModeler"));
List<GCUBERunningInstance> results=client.execute(riquery, GCUBEScope.getScope(args[0]));
*/
ModelerFactoryServiceAddressingLocator mfal =new ModelerFactoryServiceAddressingLocator();
EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
System.out.println(epr);
/*EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
System.out.println(epr);*/
EndpointReferenceType epr= new EndpointReferenceType(new URI("http://nb-lelii.isti.cnr.it:8080/wsrf/services/gcube/vremanagement/vremodeler/ModelerFactoryService"));
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope(args[0]));
@ -43,40 +39,57 @@ public class ModelerTest {
ModelerServiceAddressingLocator msal= new ModelerServiceAddressingLocator();
ModelerServicePortType msptp=msal.getModelerServicePortTypePort(eprModelerRes);
msptp = GCUBERemotePortTypeContext.getProxy(msptp, GCUBEScope.getScope(args[0]));
System.out.println("creation requested");
VRERequest vreReq= new VRERequest();
vreReq.setStartTime(new Date().getTime());
vreReq.setEndTime(new Date().getTime());
vreReq.setVREDescription("desc");
vreReq.setVREDesigner("Lucio");
vreReq.setVREManager("Lucio");
vreReq.setVREName("test");
msptp.setVREModel(vreReq);
System.out.println("first call done");
System.out.println(msptp.getGHNs(new VOID()));
/*
CollectionArray ca= new CollectionArray();
ca.setCollectionElement(new String[]{"e60f6340-e970-11dd-bb52-d1724dda0823"});
msptp.setCollection(ca);
VREDescription vreReq= new VREDescription();
Calendar cal= Calendar.getInstance();
vreReq.setStartTime(Calendar.getInstance());
cal.add(Calendar.MONTH, 1);
vreReq.setEndTime(cal);
vreReq.setDescription("desc");
vreReq.setDesigner("Lucio");
vreReq.setManager("Lucio");
vreReq.setName("testCloud");
msptp.setDescription(vreReq);
System.out.println("description set");
CollectionList cl=msptp.getCollection(new VOID());
System.out.println("collection list is null?"+(cl.getList()==null));
for(int i=0; i< cl.getList().length; i++)
System.out.println(i+" - "+cl.getList(i));
msptp.setCollection(new CollectionArray(new String[]{cl.getList(0).getId()}));
System.out.println("collection set");
FunctionalityIDArray fida= new FunctionalityIDArray();
fida.setFunctionalityIDElement(new String[]{"0"});
msptp.setFunctionality(fida);
System.out.println("functionality set");
GHNArray ghnArray= new GHNArray();
ghnArray.setGHNElement(new String[]{"64033f00-ea3a-11dd-af49-d0586efd3870","29b7ff70-ea3a-11dd-810a-d18bf0285315"});
msptp.setGHNs(ghnArray);
msptp.setUseCloud(true);
msptp.setCloudVMs(2);
System.out.println("-"+msptp.checkStatus(new VOID()).getReports(0)+"-");
//msptp.setUseCloud(false);
//msptp.setGHNs(new GHNArray(new String[]{"af63ccc0-d6a7-11df-b524-ba33a5c87470","73ceb130-e844-11df-a7f0-e529e2191760"},"af63ccc0-d6a7-11df-b524-ba33a5c87470"));
msptp.deployVRE(new VOID());
*/
for (int i=0; i<200; i++){
Thread.sleep(30000);
System.out.println("report is:");
System.out.println(msptp.checkStatus(new VOID()));
}
}catch(Exception e){e.printStackTrace();}
}