Index: trunk/README
===================================================================
--- trunk/README	(revision 639)
+++ trunk/README	(revision 1)
@@ -1,5 +1,5 @@
 The QCG Computing documentation is available online:
 
-	http://apps.man.poznan.pl/trac/qcg-computing/wiki
+	http://apps.man.poznan.pl/trac/qcg-comp/wiki
 
 Morover you can look into example JSDL and ARDL documents available in the doc directory.
Index: trunk/m4/rsync.m4
===================================================================
--- trunk/m4/rsync.m4	(revision 304)
+++ trunk/m4/rsync.m4	(revision 1)
@@ -2,21 +2,18 @@
 
 dnl
-dnl QosCosGrid Computing
-dnl Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+dnl Copyright 2010 QCG Project Team
 dnl
-dnl This program is free software: you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation, either version 3 of the License, or
-dnl (at your option) any later version.
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
 dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
+dnl     http://www.apache.org/licenses/LICENSE-2.0
 dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program.  If not, see <http://www.gnu.org/licenses/>
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
 dnl
-
 
 dnl SMC_CHECK_RSYNC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
Index: trunk/m4/libactivemq-cpp.m4
===================================================================
--- trunk/m4/libactivemq-cpp.m4	(revision 1)
+++ trunk/m4/libactivemq-cpp.m4	(revision 1)
@@ -0,0 +1,98 @@
+dnl
+dnl Copyright 2006-2010 QCG Project Team
+dnl
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+dnl
+
+dnl SMC_CHECK_LIBACTIVEMQ_CPP([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+
+AC_DEFUN([SMC_CHECK_LIBACTIVEMQ_CPP],[ 
+AC_ARG_WITH(libactivemq_cpp,
+  AS_HELP_STRING([--with-libactivemq_cpp=PATH], [Prefix (e.g. /usr/local) where the libactivemq-cpp library is installed (optional). Default: /usr/local/lib]), \
+  libactivemq_cpp_prefix="$withval/bin/", 
+  libactivemq_cpp_prefix="")
+
+  AC_MSG_CHECKING([for libactivemq_cpp])
+  no_libactivemq_cpp=""
+
+  LIBACTIVEMQ_CPP_CPPFLAGS=`$libactivemq_cpp_prefix""activemqcpp-config --includes`
+  LIBACTIVEMQ_CPP_LIBS=`$libactivemq_cpp_prefix""activemqcpp-config --libs`" -Wl,-R"`$libactivemq_cpp_prefix""activemqcpp-config --prefix`/lib
+ 
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LIBS="$LIBS"
+  CPPFLAGS="$CPPFLAGS $LIBACTIVEMQ_CPP_CPPFLAGS"
+  LIBS="$LIBACTIVEMQ_CPP_LIBS $LIBS"
+
+  AC_LANG_PUSH(C++)
+  AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/CountDownLatch.h>
+#include <decaf/lang/Long.h>
+#include <decaf/util/Date.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/util/Config.h>
+#include <activemq/library/ActiveMQCPP.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/TextMessage.h>
+#include <cms/BytesMessage.h>
+#include <cms/MapMessage.h>
+#include <cms/ExceptionListener.h>
+#include <cms/MessageListener.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <memory>
+
+using namespace activemq;
+using namespace activemq::core;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace cms;
+using namespace std;
+
+int 
+main()
+{
+   try
+   {
+	activemq::library::ActiveMQCPP::initializeLibrary();
+	activemq::library::ActiveMQCPP::shutdownLibrary();
+   }
+   catch(CMSException& e)
+   {
+	e.printStackTrace();
+        return 1;
+   }
+   return 0;  
+}
+]])],[],[no_libactivemq_cpp=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+  AC_LANG_POP(C++)
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LIBS="$ac_save_LIBS"
+
+  if test "x$no_libactivemq_cpp" = x ; then
+    AC_MSG_RESULT(yes)
+    AC_SUBST(LIBACTIVEMQ_CPP_CPPFLAGS)
+    AC_SUBST(LIBACTIVEMQ_CPP_LIBS)
+    ifelse([$1], , :, [$1])
+  else
+    AC_MSG_RESULT(no)
+    ifelse([$2], , :, [$2])
+  fi
+
+])
Index: trunk/m4/qcg-core.m4
===================================================================
--- trunk/m4/qcg-core.m4	(revision 153)
+++ trunk/m4/qcg-core.m4	(revision 1)
@@ -2,19 +2,17 @@
 
 dnl
-dnl QosCosGrid Computing
-dnl Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+dnl Copyright 2006-2009 QCG Project Team
 dnl
-dnl This program is free software: you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation, either version 3 of the License, or
-dnl (at your option) any later version.
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
 dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
+dnl     http://www.apache.org/licenses/LICENSE-2.0
 dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program.  If not, see <http://www.gnu.org/licenses/>
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
 dnl
 
Index: trunk/m4/s3.m4
===================================================================
--- trunk/m4/s3.m4	(revision 153)
+++ trunk/m4/s3.m4	(revision 1)
@@ -2,19 +2,17 @@
 
 dnl
-dnl QosCosGrid Computing
-dnl Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+dnl Copyright 2006-2009 QCG Project Team
 dnl
-dnl This program is free software: you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation, either version 3 of the License, or
-dnl (at your option) any later version.
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
 dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
+dnl     http://www.apache.org/licenses/LICENSE-2.0
 dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program.  If not, see <http://www.gnu.org/licenses/>
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
 dnl
 
Index: trunk/tools/mpi-wrapper.sh
===================================================================
--- trunk/tools/mpi-wrapper.sh	(revision 1)
+++ trunk/tools/mpi-wrapper.sh	(revision 1)
@@ -0,0 +1,49 @@
+#!/bin/sh 
+
+module load openmpi/1.4.2-gcc-4.4
+
+OMP_NUM_THREADS=`uniq -c $MACHINE_FILE | tr  -s '\t' ' ' | cut -f 2 -d ' ' | head -n 1`
+
+if [ $QCG_COMP_PROCESSES_MAP"x" != "x" ]
+then
+	TEMP_MACHINE_FILE=`mktemp machinefile.unique.XXXXX`
+	uniq $MACHINE_FILE > $TEMP_MACHINE_FILE 
+
+	QCG_COMP_PROCESSES_MAP=`echo $QCG_COMP_PROCESSES_MAP | tr : ' '`
+
+	TEMP_MACHINE_FILE_COUNT=`wc -l < $TEMP_MACHINE_FILE`
+	QCG_COMP_PROCESSES_MAP_COUNT=`echo $QCG_COMP_PROCESSES_MAP | wc -w` 
+
+	if [ $QCG_COMP_PROCESSES_MAP_COUNT -ne $TEMP_MACHINE_FILE_COUNT ]
+	then 
+		echo "Invalid QCG_COMP_PROCESSES_MAP value $QCG_COMP_PROCESSES_MAP_COUNT!=$TEMP_MACHINE_FILE_COUNT";
+	fi
+
+	QCG_COMP_PROCESSES_MAP_ARRAY=( $QCG_COMP_PROCESSES_MAP )
+	TEMP_MACHINE_FILE_ARRAY=( `cat $TEMP_MACHINE_FILE` )
+
+	: > $TEMP_MACHINE_FILE
+
+	for (( i=0; i < $QCG_COMP_PROCESSES_MAP_COUNT; i++ ))
+		do 
+			for (( j=0; j < ${QCG_COMP_PROCESSES_MAP_ARRAY[$i]}; j++ )) 
+			do 
+				echo ${TEMP_MACHINE_FILE_ARRAY[$i]} >> $TEMP_MACHINE_FILE; 
+			done 
+		done
+
+
+	export MACHINE_FILE=$TEMP_MACHINE_FILE
+fi
+
+mpi-start "$@"
+EXIT_STATUS=$?
+
+#cleanup
+if [ $TEMP_MACHINE_FILE"x" != "x" ]
+then
+	rm $TEMP_MACHINE_FILE
+fi
+
+exit $EXIT_STATUS
+
Index: trunk/tools/cross-mpi.starter
===================================================================
--- trunk/tools/cross-mpi.starter	(revision 1)
+++ trunk/tools/cross-mpi.starter	(revision 1)
@@ -0,0 +1,67 @@
+#!/bin/sh -x
+
+run_as_slave() {
+
+	STARTER_FILE="mpi-starter.sh" 
+	HOSTNAME=`hostname -f`
+
+	echo "#!/bin/sh" > $STARTER_FILE
+
+	$QCG_HOME/bin/qcg-coordinator get ${JOBID}-${HOSTNAME} >> $TMPFILE
+
+	if test $? -ne 0 
+	then
+		echo "getting MPI slave process args has failed !!!"
+		exit 2
+	fi
+
+	sed s/--daemonize// $STARTER_FILE > $STARTER_FILE.tmp
+	mv $STARTER_FILE.tmp $TMPFILE
+
+	#ugly hack - prevents OMPI from changing current working directory
+	export HOME=`pwd`
+
+	sh $STARTER_FILE
+
+	EXIT_STATUS=$?
+
+	exit $EXIT_STATUS
+}
+
+run_as_master() {
+
+	if test $QCG_MACHINE_FILE"x" = "x"
+	then
+		MACHINE_FILE=$1
+		shift
+	else
+		MACHINE_FILE=$QCG_MACHINE_FILE
+	fi
+	
+	PROCESES_COUNT=`cat $MACHINE_FILE | wc -l`
+	
+	$OMPI_HOME/bin/mpiexec --prefix $OMPI_HOME  --machinefile $MACHINE_FILE -mca plm_rsh_agent $SCRIPTS_DIR/cross-mpi.ssh -n $PROCESES_COUNT "$@"
+}
+
+
+SCRIPTS_DIR=$(cd "$(dirname "$0")" && pwd)
+
+. $SCRIPTS_DIR/cross-mpi.conf
+
+if test "x"$JOBID = "x" 
+then
+	echo "Environment variable JOBID not set !!!"
+	exit 1
+fi
+
+
+if test "x"$MASTER_GROUP = "xtrue" 
+then
+	run_as_master $@
+else
+	run_as_slave $@
+fi
+
+
+
+
Index: trunk/tools/cross-mpi.conf.in
===================================================================
--- trunk/tools/cross-mpi.conf.in	(revision 1)
+++ trunk/tools/cross-mpi.conf.in	(revision 1)
@@ -0,0 +1,2 @@
+OMPI_HOME="/opt/QCG/OMPI/"
+QCG_HOME="@QCG_COMP_DIR_PREFIX@"
Index: trunk/tools/cross-mpi.ssh
===================================================================
--- trunk/tools/cross-mpi.ssh	(revision 1)
+++ trunk/tools/cross-mpi.ssh	(revision 1)
@@ -0,0 +1,16 @@
+#!/bin/sh -x
+
+SCRIPTS_DIR=$(cd "$(dirname "$0")" && pwd)
+
+. $SCRIPTS_DIR/cross-mpi.conf
+
+HOSTNAME=$1
+shift 
+
+if test "x"$JOBID = "x" 
+then
+	echo "Environment variable JOBID not set !!!"
+	exit 1
+fi
+
+$QCG_HOME/bin/qcg-coordinator put ${JOBID}-${HOSTNAME} $# $@
Index: trunk/tools/qcg-comp-install.sh.in
===================================================================
--- trunk/tools/qcg-comp-install.sh.in	(revision 1180)
+++ trunk/tools/qcg-comp-install.sh.in	(revision 1)
@@ -1,22 +1,20 @@
-#!/bin/bash
+#!/bin/sh
 
 # $Id: submission_drmaa.c 2312 2009-04-15 17:31:24Z mmamonski $ */
 
 #
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
+# Copyright 2006-2009 QCG Project Team
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 
@@ -24,13 +22,13 @@
 DEFAULT_HOST="127.0.0.1"
 DEFAULT_PORT="5432"
-DEFAULT_DATABASE="qcg-comp"
-DEFAULT_USER="qcg-comp"
-DEFAULT_PASSWORD=`openssl rand -base64 24 || exit 3`
+DEFAULT_DATABASE="qcg_comp"
+DEFAULT_USER="qcg_comp"
+DEFAULT_PASSWORD="qcg_comp"
 DEFAULT_CREATE_USER="y"
 DEFAULT_CREATE_DATABASE="y"
 DEFAULT_USE_LOCAL_PSQL="y"
-SYSTEM_USER="qcg-comp"
+SYSTEM_USER="qcg_comp"
 SCHEMA_FILE="@QCG_COMP_DIR_DB@/qcg-comp-psql.sql"
-ODBC_DATA_SOURCE="qcg-comp"
+ODBC_DATA_SOURCE="qcg_comp"
 
 # rollback data
@@ -82,7 +80,4 @@
 	run_cmd rpm -q --quiet postgresql-server
 	run_cmd /sbin/chkconfig postgresql on
-	if [[ -n `rpm -q --queryformat "%{RELEASE}\n" postgresql | grep -v el5` ]]; then
-		run_cmd /sbin/service postgresql initdb || :
-	fi	
 }
 
@@ -93,7 +88,4 @@
 start_postgresql() {
         run_cmd /sbin/chkconfig postgresql on
-	if [[ -n `rpm -q --queryformat "%{RELEASE}\n" postgresql | grep -v el5` ]]; then
-		run_cmd /sbin/service postgresql initdb || :
-	fi	
 	run_cmd /sbin/service postgresql start
 }
@@ -149,25 +141,25 @@
 }
 
-remote_psql() {                                                                                                                                                                                                                                                 
-        user=$1                                                                                                                                                                                                                                                 
-        shift                                                                                                                                                                                                                                                   
-        run_cmd su - $user -c "psql -h \"$HOST\" -p $PORT -U \"$USER\" $@"                                                                                                                                                                              
-}                                                                                                                                                                                                                                                               
-                                                                                                                                                                                                                                                                
-create_user() {                                                                                                                                                                                                                                                 
-        local_psql postgres "-c \"CREATE ROLE \\\"$USER\\\" PASSWORD '$PASSWORD' LOGIN;\""                                                                                                                                                                      
-}                                                                                                                                                                                                                                                               
-                                                                                                                                                                                                                                                                
-delete_user() {                                                                                                                                                                                                                                                 
-        local_psql postgres "-c \"DROP ROLE \\\"$USER;\\\""                                                                                                                                                                                                     
-}                                                                                                                                                                                                                                                               
-                                                                                                                                                                                                                                                                
-create_database() {                                                                                                                                                                                                                                             
-        local_psql postgres "-c \"CREATE DATABASE \\\"$DATABASE\\\" OWNER \\\"$USER\\\";\""                                                                                                                                                                     
-}                                                                                                                                                                                                                                                               
-                                                                                                                                                                                                                                                                
-delete_database() {                                                                                                                                                                                                                                             
-        local_psql postgres "-c \"DROP DATABASE \\\"$DATABASE\\\";\""                                                                                                                                                                                           
-}   
+remote_psql() {
+	user=$1
+	shift
+	run_cmd su - $user -c "psql -h $HOST -p $PORT -U $USER $@"
+}
+
+create_user() {
+	local_psql postgres "-c \"CREATE ROLE $USER PASSWORD '$PASSWORD' LOGIN;\""
+}
+
+delete_user() {
+	local_psql postgres "-c \"DROP ROLE $USER;\""
+}
+
+create_database() {
+	local_psql postgres "-c \"CREATE DATABASE $DATABASE OWNER $USER;\""
+}
+
+delete_database() {
+	local_psql postgres "-c \"DROP DATABASE $DATABASE;\""
+}
 
 create_schema() {
@@ -278,5 +270,4 @@
 			echo  -n "Starting PostgreSQL server..."
 			start_postgresql
-            sleep 5
 			status
 		fi
@@ -314,5 +305,5 @@
 
 echo -n " * Checking for ODBC data source $ODBC_DATA_SOURCE..."
-check_odbc_data_source qcg-comp
+check_odbc_data_source qcg_comp
 
 if [ $? -eq 0 ]; then
Index: trunk/tools/Makefile.am
===================================================================
--- trunk/tools/Makefile.am	(revision 653)
+++ trunk/tools/Makefile.am	(revision 1)
@@ -1,8 +1,14 @@
 # $Id: Makefile.am 2312 2009-04-15 17:31:24Z mmamonski $
 
+CONF_FILES = cross-mpi.conf
 NOCONF_FILES = qcg-comp-install.sh
  
-SUBST_FILES =  $(NOCONF_FILES)
+SUBST_FILES = 	$(CONF_FILES) \
+				$(NOCONF_FILES)
 	
+NOSUBST_FILES = \
+		cross-mpi.starter \
+		cross-mpi.ssh \
+		mpi-wrapper.sh
 
 SRC_FILES = $(SUBST_FILES:=.in)
@@ -23,9 +29,9 @@
 
 BUILT_SOURCES = $(SUBST_FILES)
-EXTRA_DIST = $(SRC_FILES)
+EXTRA_DIST = $(SRC_FILES) $(NOSUBST_FILES)
 CLEANFILES = $(SUBST_FILES)
 
 
-install-data-local: $(SUBST_FILES) 
+install-data-local: $(SUBST_FILES) $(NOSUBST_FILES)
 	$(INSTALL) -m 755 -d $(DESTDIR)/$(pkgdatadir)/tools
 	for i in $(CONF_FILES); do \
Index: trunk/java/WSIT/QCGComputingSDK/publish.sh
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/publish.sh	(revision 1139)
+++ trunk/java/WSIT/QCGComputingSDK/publish.sh	(revision 1)
@@ -4,3 +4,3 @@
 mvn -Dmaven.test.skip=true package
 
-scp target/QCGComputingSDK-4.0.0-dist.tar.gz *****
+scp target/QCGComputingSDK-2.2.0-dist.tar.gz fury:/home/mmamonski/public_html/qcg-downloads/qcg-comp/java-sdk
Index: trunk/java/WSIT/QCGComputingSDK/README-DEVELOPER
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/README-DEVELOPER	(revision 1139)
+++ trunk/java/WSIT/QCGComputingSDK/README-DEVELOPER	(revision 1)
@@ -3,5 +3,5 @@
 
  *  Maven (>= 2.0)
- * `QCG Core Java SDK <https://www.qoscosgrid.org/svn/qcg-core/trunk/java/WSIT/QCGCoreSDK>`
+ * `QCG Core Java SDK <https://gforge.man.poznan.pl/svn/qcgcore/trunk/java/WSIT/QCGCoreSDK>`_
 
 Compilation
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompHTTPGExample.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompHTTPGExample.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompHTTPGExample.java	(revision 1)
@@ -0,0 +1,57 @@
+package com.qcg.comp.tests;
+
+
+
+import java.io.FileInputStream;
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.core.sdk.security.gsi.GSIAuthentication;
+
+/**
+ * Unit test for simple Job submission.
+ */
+public class QCGCompHTTPGExample 
+    extends TestCase
+{
+	public static final String QCG_COMPUTING_HOST = "elder1.man.poznan.pl";
+	public static final int QCG_COMPUTING_PORT = 19000;
+	
+	public void testSubmit() throws Exception {
+		QCGFactory besFactory =  new QCGFactory(QCG_COMPUTING_HOST, QCG_COMPUTING_PORT, new GSIAuthentication(new FileInputStream("/tmp/x509up_u501"), "/C=PL/O=GRID/O=PSNC/CN=qcg/elder1.man.poznan.pl"), true);
+		
+		/* create an JSDL document */
+		JSDL dateJSDL = new JSDL("SimpleJob");
+		
+		dateJSDL.setExecutable("/bin/sleep");
+		dateJSDL.getArguments().add("8000");
+		
+		/* submit a job */
+		ActivityEndpointReference jobEpr = besFactory.createActivity(dateJSDL);
+		
+		System.err.println("Activity ID: " + jobEpr.getActivityUUID());
+		
+		QCGActivityStatus status = null;
+		/* wait for termination */
+		while (!(status =besFactory.getActivityStatus(jobEpr)).isFinalState()) { 
+			Thread.sleep(500);
+			System.err.println("Status = " + status);
+			besFactory =  new QCGFactory(QCG_COMPUTING_HOST, QCG_COMPUTING_PORT, new GSIAuthentication(new FileInputStream("/tmp/x509up_u501"), "/C=PL/O=GRID/O=PSNC/CN=qcg/elder1.man.poznan.pl"), true);
+		}
+		
+		
+		if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED)) {
+			System.out.println("Job " + status.getActivityIdentifier() + " finished with exit status: " + status.getEndStatus().getExitStatus() );
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FAILED)){
+			System.err.println("Job " + status.getActivityIdentifier() + " failed");
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED)){
+			System.err.println("Job " + status.getActivityIdentifier() + " was cancelled");
+		}
+		
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/BreinStagingTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/BreinStagingTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/BreinStagingTest.java	(revision 1)
@@ -0,0 +1,47 @@
+package com.qcg.comp.tests;
+
+
+
+import java.io.FileReader;
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class BreinStagingTest 
+    extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+	
+	public void testDateStagingBrein() throws Throwable {
+		
+		JSDL jsdl = new JSDL(new FileReader(getRes("brein.xml")));
+		
+		ActivityEndpointReference jobEpr = factory.createActivity(jsdl);
+		
+		
+		System.err.println("jobEpr = " + jobEpr);
+		
+		
+		QCGActivityStatus stat = null;
+		while (!(stat = factory.getActivityStatus(jobEpr)).isFinalState()) {
+			System.err.println(stat);
+			Thread.sleep(5000);
+		}
+		
+		jobEpr = new ActivityEndpointReference(jobEpr.getAddress(), jobEpr.getActivityUUID());
+		
+		System.err.println("final stat: " + stat);
+
+		System.err.println("Job is done!");
+	}	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuTest.java	(revision 1)
@@ -0,0 +1,67 @@
+package com.qcg.comp.tests;
+
+
+
+import java.util.Date;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class AROneCpuTest extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	
+	public void testReservationOneCpu() throws Exception {
+		
+		try {
+		ARDL ardl = new ARDL(120);
+		ardl.setUserName(username1);
+		
+		resEpr1 = ares.createReservation(ardl);
+		
+		System.err.println("Reservation created: " + resEpr1);
+		
+		//ares.terminateReservation(repr);
+		//System.err.println("Reservation terminated.");
+		
+		JSDL jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.getArguments().add("20");
+		jsdl.setReservationIdentifier(resEpr1);
+		jsdl.setUserName(username1);
+		
+		jobEpr1 = factory.createActivity(jsdl);
+		
+		System.err.println("Job submitted = " + new Date());
+		
+		System.err.println("jobEpr = " + jobEpr1);
+		
+		waitForState(jobEpr1, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+		
+		System.err.println("Job started = " + new Date());
+		
+		jobEpr1 = new ActivityEndpointReference(jobEpr1.getAddress(), jobEpr1.getActivityUUID());
+		
+		waitForTermination(jobEpr1);
+		
+		System.err.println("Job finished with stat " +  factory.getActivityStatus(jobEpr1) + " = " + new Date());
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			fail();
+		} finally {
+			ares.terminateReservation(resEpr1);
+		}
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ListDirectoryStagingTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ListDirectoryStagingTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ListDirectoryStagingTest.java	(revision 1)
@@ -0,0 +1,103 @@
+package com.qcg.comp.tests;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.qcg.comp.sdk.QCGStaging;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.jsdl.JSDLDataStaging;
+import com.qcg.comp.sdk.types.FileInfo;
+import com.qcg.core.sdk.security.AuthenticationModule;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+
+public class ListDirectoryStagingTest {
+
+    protected QCGStaging staging;
+
+    public static final String baseDir = "/tmp";       
+
+    @Before
+    public void setUp() throws Exception {
+	String hostname = "localhost";
+	int port = 19000;
+	boolean useWSA = true;
+	AuthenticationModule am = new AnonymousAuthentication();
+
+	staging = new QCGStaging(hostname, port, am, useWSA, null);	
+    }
+
+    @Test
+    public void listFiles() throws Throwable {
+	JSDL jsdl = staging.listDirectory(baseDir, null);		
+	File dir = new File(baseDir);
+	
+	ArrayList<String> local = new ArrayList<String>();	
+	
+	for(String f : dir.list())
+	    local.add(f);
+	
+	for(JSDLDataStaging ds : jsdl.getDataStaging())
+	    local.remove(ds.getFileName());
+	
+	assertTrue(local.isEmpty());
+    }
+    
+    @Test
+    public void statFile() throws Throwable {
+	ArrayList<String> files = new ArrayList<String>();
+	files.add("/etc/passwd");
+	FileInfo[] file = staging.statFile(files, null);
+	assertEquals(1, file.length);
+	File f=new File("/etc/passwd");	
+	assertEquals(f.length(), file[0].getSize());
+	assertEquals("root", file[0].getOwner());
+    }
+    
+    @Test
+    public void delete() throws Throwable {
+	File f=File.createTempFile("staging", "delete");
+	assertTrue(f.exists());
+	staging.delete(f.getAbsolutePath(), null);
+	assertFalse(f.exists());
+    }
+
+    @Test
+    public void chmod() throws Throwable {
+	File f = File.createTempFile("staing", "chmod");
+	f.deleteOnExit();
+	f.setWritable(true, true);
+	f.setReadable(false, false);
+	assertFalse(f.canRead());
+	assertTrue(f.canWrite());
+	staging.chmod(f.getAbsolutePath(), "0444", null);
+	assertTrue(f.canRead());
+	assertFalse(f.canWrite());
+    }
+
+    @Test
+    public void mkdir() throws Throwable {
+	String path = "/tmp/staging_test";
+	staging.mkdir(path, null, null);
+	File f = new File(path);
+	assertTrue(f.exists());
+	assertTrue(f.isDirectory());
+	f.delete();
+    }
+
+    @Test
+    public void mkdir_with_perms() throws Throwable {
+	String path = "/tmp/staging_test";
+	staging.mkdir(path, "555", null);
+	File f = new File(path);
+	assertTrue(f.exists());
+	assertTrue(f.isDirectory());
+	assertTrue(f.canRead());
+	assertFalse(f.canWrite());
+	f.delete();
+    }
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/SimpleSubmitTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/SimpleSubmitTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/SimpleSubmitTest.java	(revision 1)
@@ -0,0 +1,46 @@
+package com.qcg.comp.tests;
+
+
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class SimpleSubmitTest 
+    extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	
+	public void testSleepSubmit() throws Throwable {
+		
+		JSDL jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.setUserName(username1);
+		jsdl.getArguments().add("20");
+		
+		jobEpr1 = factory.createActivity(jsdl);
+		
+		System.err.println("jobEpr = " + jobEpr1);
+		System.err.println("job document = " + factory.getActivityDocuments(jobEpr1).getJsdl());
+		System.err.println("local job id = " + factory.getActivityDocuments(jobEpr1).getLocalActivityId());
+		
+		waitForTermination(jobEpr1);
+		
+		//try to create job EPR form scratch
+		jobEpr1 = new ActivityEndpointReference(jobEpr1.getAddress(), jobEpr1.getActivityUUID());
+		
+		System.err.println("final stat: " + factory.getActivityStatus(jobEpr1));
+		assertEquals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED, factory.getActivityStatus(jobEpr1).getState());
+		assertEquals(0, factory.getActivityStatus(jobEpr1).getEndStatus().getExitStatus().intValue());
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/GetFactoryAttributesTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/GetFactoryAttributesTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/GetFactoryAttributesTest.java	(revision 1)
@@ -0,0 +1,33 @@
+package com.qcg.comp.tests;
+
+import com.qcg.comp.stubs.bes.factory.BasicResourceAttributesDocumentType;
+import com.qcg.comp.stubs.bes.factory.FactoryResourceAttributesDocumentType;
+
+/**
+ * Unit test for simple App.
+ */
+public class GetFactoryAttributesTest 
+    extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	
+	public void testGetFactoryAttr() throws Throwable {
+		FactoryResourceAttributesDocumentType fa =  factory.getFactoryAttributesDocument();
+		int totalCount = 0;
+		
+		for (int i = 0; i < fa.getTotalNumberOfContainedResources(); i++) {
+			BasicResourceAttributesDocumentType bra = (BasicResourceAttributesDocumentType)fa.getContainedResource().get(i);  
+			System.err.println(bra.getResourceName() + ": CPU arch = " + bra.getCPUArchitecture().getCPUArchitectureName() + ",CPU count = " + bra.getCPUCount());
+			totalCount += bra.getCPUCount().intValue();
+		}
+		
+		System.err.println("Total CPU count = " + totalCount);
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/SimpleAppSubmitTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/SimpleAppSubmitTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/SimpleAppSubmitTest.java	(revision 1)
@@ -0,0 +1,30 @@
+package com.qcg.comp.tests;
+
+
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class SimpleAppSubmitTest 
+    extends QCGCompConfig
+{
+
+	
+	public void testAppNameSubmit() throws Throwable {
+		
+		jsdl = new JSDL("date");
+		jsdl.setApplicationName("date");
+		jsdl.setUserName(username1);
+		
+		jobEpr1 = factory.createActivity(jsdl);
+		
+		waitForTermination(jobEpr1);
+		assertEquals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED, factory.getActivityStatus(jobEpr1).getState());
+		assertEquals(0, factory.getActivityStatus(jobEpr1).getEndStatus().getExitStatus().intValue());
+	}
+	
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/StageLargeTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/StageLargeTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/StageLargeTest.java	(revision 1)
@@ -0,0 +1,43 @@
+package com.qcg.comp.tests;
+
+
+
+import java.io.File;
+import java.io.FileReader;
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.jsdl.JSDLDataStaging;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class StageLargeTest 
+    extends QCGCompConfig
+{
+	protected static final String stagedInFile = "/tmp/100MB.file";
+	protected static final String stagedOutFile = "/tmp/100MB.file.out";
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+	}
+	
+	public void testLargeAttachmentStaging() throws Throwable {
+		
+		JSDL jsdl = new JSDL("LargeStaging");
+		
+		jsdl.getDataStaging().add(new JSDLDataStaging("1000MB.file", stagedInFile, stagedOutFile));
+		
+		
+		System.err.println("Stage in");
+		staging.stageInFiles(jsdl);
+		System.err.println("Stage out");
+		staging.stageOutFiles(jsdl);
+		
+		assertFileEquals(new File(stagedInFile), new File(stagedOutFile));
+		
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompConfig.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompConfig.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompConfig.java	(revision 1)
@@ -0,0 +1,175 @@
+package com.qcg.comp.tests;
+
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.Inet4Address;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.ARES;
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.QCGStaging;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownActivityIdentifierException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.comp.stubs.ares.ARESReservationStatusType;
+import com.qcg.comp.stubs.ares.ARESReservedHostType;
+import com.qcg.core.sdk.attachments.SimpleFileStagingHandler;
+import com.qcg.core.sdk.security.AuthenticationModule;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+import com.qcg.core.sdk.utils.IOUtils;
+
+/**
+ * Unit test for simple App.
+ */
+public class QCGCompConfig 
+    extends TestCase
+{
+	public static final String TESTSUITE_PFX = "testsuite.";
+	
+	protected QCGFactory factory;
+	protected ARES ares;
+	protected QCGStaging staging;
+	protected String username1;
+	protected String username2;
+	protected Properties config = new Properties();
+	protected List<String> disabledTests = new ArrayList<String>();
+	protected ActivityEndpointReference jobEpr1;
+	protected ActivityEndpointReference jobEpr2;
+	protected ReservationEndpointReference resEpr1;
+	protected ReservationEndpointReference resEpr2;
+	protected JSDL jsdl;
+	protected ExecutorService pool = Executors.newCachedThreadPool();
+	protected String localHostname; 
+
+	@Override
+	protected void setUp() throws Exception {
+		String confFileName = System.getProperty(TESTSUITE_PFX + "config", "/default.properties");
+		config.load(new FileInputStream(getRes(confFileName)));
+		
+		localHostname = Inet4Address.getLocalHost().getHostName();
+		
+		String hostname = config.getProperty(TESTSUITE_PFX + "hostname");
+		int port = Integer.parseInt(config.getProperty(TESTSUITE_PFX + "port"));
+		boolean useWSA = Boolean.parseBoolean(config.getProperty(TESTSUITE_PFX + "useWSA"));
+		
+		System.err.println("Using QCGComp: " + hostname + ":" + port);
+		
+		AuthenticationModule am = null;
+		String authMethod  = config.getProperty(TESTSUITE_PFX + "authentication"); 
+		if (authMethod.equalsIgnoreCase("anonymous")) {
+			am = new AnonymousAuthentication();
+		} else if (authMethod.equals("gsi")) {
+			//am = GSIAuthentication("/O=Grid/OU=QosCosGrid/CN=opendsp/node2.qoscosgrid.man.poznan.pl");
+		} else {
+			throw new IllegalArgumentException("Unknown authentication method");
+		}
+		
+		boolean soapDump = Boolean.parseBoolean(config.getProperty(TESTSUITE_PFX + "soapdump", "false"));
+		System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", soapDump +"");
+		
+		username1 = config.getProperty(TESTSUITE_PFX + "user1.name");
+		username2 = config.getProperty(TESTSUITE_PFX + "user2.name");
+		
+		factory = new QCGFactory(hostname, port, am,  useWSA);
+		ares =  new ARES(hostname, port, am,  useWSA);
+		staging = new QCGStaging(hostname, port, am, useWSA, new SimpleFileStagingHandler());
+		
+		String dts[] = config.getProperty(TESTSUITE_PFX + "disabledTests").split("\\s*,\\s*");
+		
+		for (String dt : dts) {
+			disabledTests.add(dt);
+		}
+
+	}
+	
+	
+	@Override
+	protected void tearDown() throws Exception {
+		factory = null;
+		ares =  null;
+		staging = null;
+	}
+
+
+	public void waitForTermination(ActivityEndpointReference epr) throws NotAuthorizedException, UnknownActivityIdentifierException, InterruptedException  {
+		QCGActivityStatus stat = null;
+		while (!(stat = factory.getActivityStatus(epr)).isFinalState()) {
+			System.err.println(stat);
+			Thread.sleep(2000);
+		}
+
+		System.err.println(stat);
+	}
+	
+	public void waitForState(ActivityEndpointReference epr, String state) throws NotAuthorizedException, UnknownActivityIdentifierException, InterruptedException {
+		QCGActivityStatus stat = null;
+		while (!(stat = factory.getActivityStatus(epr)).getState().equals(state)) {
+			System.err.println(stat);
+			Thread.sleep(2000);
+		}
+		
+		System.err.println(stat);
+	}
+
+	
+	public boolean isDisabled(){
+		String className[] = this.getClass().getName().split("\\.");
+		boolean res = false;
+		
+		for (String dt :  disabledTests ) {
+			//System.err.println("comparing : " + dt + " with " + className[className.length - 1]);
+			 res =  res || className[className.length - 1].matches(dt);
+		}
+		
+		if (res) {
+			System.err.println("TEST DISABLED: " + className[className.length -1]);
+		}
+		
+		return res;
+	}
+	
+	protected String getRes(String name){
+		if ((new File(name)).exists())
+			return name;
+		
+		return QCGCompConfig.class.getResource(name).getPath();
+	}
+	
+	
+	public static void assertFileEquals(File f1, File f2) throws IOException {
+		assertEquals(IOUtils.fileToString(f1), IOUtils.fileToString(f2));
+	}
+
+
+	@Override
+	protected void runTest() throws Throwable {
+		if (!isDisabled())
+			super.runTest();
+	}
+	
+	public static void printReservationStatus(ARESReservationStatusType rt) {
+		System.err.println("reserved hosts");
+		
+		if (rt.getReservedHost() != null) {
+			for (ARESReservedHostType rh : rt.getReservedHost()) {
+				System.err.println("[host=" + rh.getHostName() 
+						+ ",totalCpu=" +  rh.getTotalSlotsCount() 
+						+ ",reservedCpu=" + rh.getReservedSlotsCount()
+						+ ",usedCpu=" + rh.getUsedSlotsCount() + "]");
+			}
+		}
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGResManagerTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGResManagerTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGResManagerTest.java	(revision 1)
@@ -0,0 +1,133 @@
+package com.qcg.comp.tests;
+
+
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownReservationIdentifierException;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+/**
+ * Unit test for simple App.
+ */
+public class QCGResManagerTest extends QCGCompConfig
+{
+	
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+	}
+
+	
+	static SimpleDateFormat dateformat = new SimpleDateFormat("yyyy:MM:dd HH:mm");
+	
+	public void testQCG() throws ParseException {
+		
+		//by default use INRIA to change this see FedCompTest.java
+		ReservationEndpointReference rAll1 = null;
+		ReservationEndpointReference rAll2 = null;
+		
+	try {
+		
+		Date time1 = dateformat.parse("2009:03:01 8:00");
+		Date time2 = dateformat.parse("2009:03:01 11:00");
+		Date time3 = dateformat.parse("2009:03:01 13:00");
+		Date time4 = dateformat.parse("2009:03:01 16:00");
+
+		ARDL ardl = new ARDL(time2, time3); 
+		
+		ardl.setUserName(username1); 
+		ardl.setName("12345");
+		ardl.setTotalSlotsCount(1);
+		ardl.setAdditionalSlotsCount(1);
+		ardl.setStrictWindow(true);
+		
+		resEpr1 = ares.createReservation(ardl);
+		
+		assertEquals(time2, ares.getReservationDocument(resEpr1).getArdl().getStartTime());
+		assertEquals(time3, ares.getReservationDocument(resEpr1).getArdl().getEndTime());
+		
+		ardl = new ARDL(time1, time4); 
+		
+		ardl.setUserName(username1); 
+		ardl.setName("12345");
+		ardl.setTotalSlotsCount(1);
+		ardl.setAdditionalSlotsCount(1);
+		ardl.setStrictWindow(false);
+		
+		rAll1 = ares.createReservation(ardl);
+		
+		assertEquals(time1, ares.getReservationDocument(rAll1).getArdl().getStartTime());
+		assertEquals(time2, ares.getReservationDocument(rAll1).getArdl().getEndTime());
+		
+		/* use the same ardl to get second "slice" */
+		rAll2 = ares.createReservation(ardl);
+		
+		assertEquals(time3, ares.getReservationDocument(rAll2).getArdl().getStartTime());
+		assertEquals(time4, ares.getReservationDocument(rAll2).getArdl().getEndTime());
+		
+		Thread.sleep(20000);
+		try {
+			//we must communicate to RTIS that something we are finishing global reservation phase
+			ares.createReservation(ardl);
+			fail();
+		} catch (Exception ex) {
+			
+		}
+		
+		ares.terminateReservation(rAll1);
+		ares.terminateReservation(rAll2);
+		ares.terminateReservation(resEpr1);
+		
+	} catch (Throwable ex) {
+			ex.printStackTrace();
+			
+			if (rAll1 != null) {
+				try {
+					ares.terminateReservation(rAll1);
+				} catch (NotAuthorizedException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (UnknownReservationIdentifierException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+			
+			if (rAll2 != null) {
+				try {
+					ares.terminateReservation(rAll2);
+				} catch (NotAuthorizedException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (UnknownReservationIdentifierException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+			
+			if (resEpr1 != null) {
+				try {
+					ares.terminateReservation(resEpr1);
+				} catch (NotAuthorizedException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (UnknownReservationIdentifierException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+			
+
+			
+			fail();
+		}
+		
+	}
+	
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/CurlStagingTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/CurlStagingTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/CurlStagingTest.java	(revision 1)
@@ -0,0 +1,48 @@
+package com.qcg.comp.tests;
+
+
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.jsdl.JSDLDataStaging;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class CurlStagingTest 
+    extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+	
+	public void testCurlStaging() throws Throwable {
+		
+		JSDL jsdl = new JSDL("date");
+		jsdl.setExecutable("/bin/date");
+		jsdl.getDataStaging().add(new JSDLDataStaging("inout", "http://hedera.man.poznan.pl/", null));
+		jsdl.getDataStaging().add(new JSDLDataStaging("inout", null, "file:///tmp/services"));
+		
+		ActivityEndpointReference jobEpr = factory.createActivity(jsdl);
+		
+		System.err.println("jobEpr = " + jobEpr);
+		
+		
+		QCGActivityStatus stat = null;
+		while (!(stat = factory.getActivityStatus(jobEpr)).isFinalState()) {
+			System.err.println(stat);
+			Thread.sleep(5000);
+		}
+		
+		jobEpr = new ActivityEndpointReference(jobEpr.getAddress(), jobEpr.getActivityUUID());
+		
+		System.err.println("final stat: " + stat);
+
+		System.err.println("Job is done!");
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/TerminateJobTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/TerminateJobTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/TerminateJobTest.java	(revision 1)
@@ -0,0 +1,34 @@
+package com.qcg.comp.tests;
+
+
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class TerminateJobTest 
+    extends QCGCompConfig
+{
+
+	public void testSleepKill() throws Throwable {
+		
+		jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.getArguments().add("60");
+		jsdl.setUserName(username1);
+		jobEpr1 = factory.createActivity(jsdl);
+		
+		System.err.println("jobEpr1 = " + jobEpr1);
+
+		factory.terminateActivity(jobEpr1);
+		
+		waitForTermination(jobEpr1);
+		
+		assertEquals(factory.getActivityStatus(jobEpr1).getState(), QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED);
+
+	}
+
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuHostnameMultiuserTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuHostnameMultiuserTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuHostnameMultiuserTest.java	(revision 1)
@@ -0,0 +1,128 @@
+package com.qcg.comp.tests;
+
+
+
+import java.util.Date;
+import java.util.List;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class AROneCpuHostnameMultiuserTest 
+    extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+	}
+	
+	public void testReservationTwoCpu() throws Exception {
+		
+		try {
+		ARDL ardl = new ARDL(120); // create resr for 120 s; 
+		ardl.setTotalSlotsCount(1);
+
+		ardl.setUserName(username1);
+		//ardl.setName("sessionId");
+		ReservationEndpointReference rEpr1 = ares.createReservation(ardl);
+		System.err.println("Reservation created" + username1 + " = "  + rEpr1);
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+
+		ardl.setUserName(username2);
+		ReservationEndpointReference rEpr2 = ares.createReservation(ardl);
+		System.err.println("Reservation created" + username2 + " = "  + rEpr2);
+		
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+		
+		List<ReservationEndpointReference> activeReservations = ares.getActiveReservations();
+		
+		System.err.println("Active reservations: " + activeReservations.size());
+		for (ReservationEndpointReference rEpr : activeReservations) {
+			System.err.println(rEpr);
+		}
+		
+		JSDL jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.getArguments().add("50");
+		
+		jsdl.setUserName(username1);
+		jsdl.setReservationIdentifier(rEpr1);
+		ActivityEndpointReference jobEpr1 = factory.createActivity(jsdl);
+		System.err.println(username1 + ": Job submitted = " + new Date());
+		System.err.println(username1 + ": jobEpr = " + jobEpr1);
+		
+		jsdl.setUserName(username2);
+		jsdl.setReservationIdentifier(rEpr2);
+		ActivityEndpointReference jobEpr2 = factory.createActivity(jsdl);
+		System.err.println(username2 + ": Job submitted = " + new Date());
+		System.err.println(username2 + ": jobEpr = " + jobEpr2);
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+
+		QCGActivityStatus stat = null;
+		while (!(stat = factory.getActivityStatus(jobEpr1)).getState().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING)) {
+			Thread.sleep(5000);
+		}
+		
+		System.err.println(username1 + ": Job started = " + new Date());
+		
+		System.err.println(ares.getReservationDocument(rEpr1));
+		System.err.println(ares.getReservationDocument(rEpr2));
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+		
+		while (!(stat = factory.getActivityStatus(jobEpr2)).getState().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING)) {
+			Thread.sleep(5000);
+		}
+
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+
+		
+		System.err.println(username2 + ": Job started = " + new Date());
+		
+		while (!(stat = factory.getActivityStatus(jobEpr1)).isFinalState()) {
+			printReservationStatus(ares.getReservationStatus(rEpr1));
+			printReservationStatus(ares.getReservationStatus(rEpr2));
+			Thread.sleep(5000);
+			printReservationStatus(ares.getReservationStatus(rEpr1));
+			printReservationStatus(ares.getReservationStatus(rEpr2));
+		}
+
+		assertEquals("Finished", stat.getState());
+
+		System.err.println(username1 + ": Job finished with stat " +  stat + " = " + new Date());
+		
+		while (!(stat = factory.getActivityStatus(jobEpr1)).isFinalState()) {
+			Thread.sleep(5000);
+		}
+		assertEquals("Finished", stat.getState());
+		
+		System.err.println(username1 + ": Job finished with stat " +  stat + " = " + new Date());
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+		
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			fail();
+		} finally {
+			ares.terminateReservation(resEpr1);
+			ares.terminateReservation(resEpr2);
+		}
+
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuMultiuserTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuMultiuserTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/AROneCpuMultiuserTest.java	(revision 1)
@@ -0,0 +1,134 @@
+package com.qcg.comp.tests;
+
+
+
+import java.util.Date;
+import java.util.List;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class AROneCpuMultiuserTest 
+    extends QCGCompConfig
+{
+	
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+	}
+	
+	
+	public void testReservationTwoCpu() throws Exception {
+		
+		ARDL ardl = new ARDL(60); // create resr for 60 s; 
+
+		ardl.setUserName(username1);
+		ardl.setName("2");
+		ardl.setTotalSlotsCount(1);
+		
+		//ardl.getCandiateHosts().add("qcg1.lri.fr");
+		//ardl.setAdditionalCPUCount(1);
+		
+		ReservationEndpointReference rEpr1 = ares.createReservation(ardl);
+		System.err.println("Reservation created" + username1 + " = "  + rEpr1);
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+
+		ardl.setUserName(username2);
+		//ardl.getCandiateHosts().add("qcg1.lri.fr");
+		//ardl.getCandiateHosts().add("qcg4.lri.fr");
+
+		ReservationEndpointReference rEpr2 = ares.createReservation(ardl);
+		System.err.println("Reservation created" + username2 + " = "  + rEpr2);
+		
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+
+
+		List<ReservationEndpointReference> activeReservations = ares.getActiveReservations();
+		
+		System.err.println("Active reservations: " + activeReservations.size());
+		for (ReservationEndpointReference rEpr : activeReservations) {
+			System.err.println(rEpr);
+			System.err.println("ResDocument = " + ares.getReservationDocument(rEpr));
+			System.err.println("ResLocalId  = " + ares.getReservationDocument(rEpr).getLocalReservationId());
+		}
+		
+		
+		JSDL jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.getArguments().add("10");
+		
+		jsdl.setUserName(username1);
+		jsdl.setReservationIdentifier(rEpr1);
+		ActivityEndpointReference jobEpr1 = factory.createActivity(jsdl);
+		System.err.println(username1 + ": Job submitted = " + new Date());
+		System.err.println(username1 + ": jobEpr = " + jobEpr1);
+		
+		jsdl.setUserName(username2);
+		jsdl.setReservationIdentifier(rEpr2);
+		ActivityEndpointReference jobEpr2 = factory.createActivity(jsdl);
+		System.err.println(username2 + ": Job submitted = " + new Date());
+		System.err.println(username2 + ": jobEpr = " + jobEpr2);
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+
+		QCGActivityStatus stat = null;
+		while (!(stat = factory.getActivityStatus(jobEpr1)).getState().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING)) {
+			Thread.sleep(5000);
+			System.err.println(stat);
+			
+		}
+		
+		System.err.println(username1 + ": Job started = " + new Date());
+		
+		System.err.println(ares.getReservationDocument(rEpr1));
+		System.err.println(ares.getReservationDocument(rEpr2));
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+		
+		while (!(stat = factory.getActivityStatus(jobEpr2)).getState().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING)) {
+			Thread.sleep(5000);
+			System.err.println(stat);
+		}
+
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+
+		
+		System.err.println(username2 + ": Job started = " + new Date());
+		
+		while (!(stat = factory.getActivityStatus(jobEpr1)).isFinalState()) {
+			printReservationStatus(ares.getReservationStatus(rEpr1));
+			printReservationStatus(ares.getReservationStatus(rEpr2));
+			Thread.sleep(5000);
+			printReservationStatus(ares.getReservationStatus(rEpr1));
+			printReservationStatus(ares.getReservationStatus(rEpr2));
+		}
+
+		assertEquals("Finished", stat.getState());
+
+		System.err.println(username1 + ": Job finished with stat " +  stat + " = " + new Date());
+		
+		while (!(stat = factory.getActivityStatus(jobEpr1)).isFinalState()) {
+			Thread.sleep(5000);
+		}
+		assertEquals("Finished", stat.getState());
+		
+		System.err.println(username1 + ": Job finished with stat " +  stat + " = " + new Date());
+		
+		printReservationStatus(ares.getReservationStatus(rEpr1));
+		printReservationStatus(ares.getReservationStatus(rEpr2));
+
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompExtendedExample.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompExtendedExample.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompExtendedExample.java	(revision 1)
@@ -0,0 +1,76 @@
+package com.qcg.comp.tests;
+
+
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.comp.stubs.bes.factory.BasicResourceAttributesDocumentType;
+import com.qcg.comp.stubs.bes.factory.FactoryResourceAttributesDocumentType;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+
+/**
+ * Unit test for simple Job submission.
+ */
+public class QCGCompExtendedExample 
+    extends TestCase
+{
+	public static final String QCG_COMPUTING_HOST = "grass1.man.poznan.pl";
+	public static final int QCG_COMPUTING_PORT = 19001;
+	
+	public void testExtended() throws Exception {
+		
+		/* stubs initialization */
+		QCGFactory besFactory =  new QCGFactory(QCG_COMPUTING_HOST, QCG_COMPUTING_PORT,  new AnonymousAuthentication(), true);
+		
+		/* machines monitoring */
+		FactoryResourceAttributesDocumentType cluster = besFactory.getFactoryAttributesDocument();
+		
+		System.out.println("Cluster Name        :" + cluster.getCommonName());
+		System.out.println("Cluster description :" + cluster.getLongDescription());
+		System.out.println("DRMS Type           :" + cluster.getLocalResourceManagerType());
+		System.out.println("\nMachines:\n");
+		for (Object rr : cluster.getContainedResource()) {
+			BasicResourceAttributesDocumentType host = (BasicResourceAttributesDocumentType)rr;
+			System.out.println(host.getResourceName() + "[arch=" + host.getCPUArchitecture().getCPUArchitectureName() + ",cpucount=" + host.getCPUCount() + ",physMem=" + host.getPhysicalMemory().intValue() / (1024 * 1024) + "MB]");
+		}
+		
+		/* Job submission */
+		
+		/* create an JSDL document */
+		JSDL dateJSDL = new JSDL("JobName");
+		
+		dateJSDL.setExecutable("/bin/date");
+		dateJSDL.getArguments().add("-R");
+		dateJSDL.getEnvironment().put("TZ", "Pacific/Honolulu");
+		
+		/* submit a job */
+		ActivityEndpointReference jobEpr = besFactory.createActivity(dateJSDL);
+		System.out.println("\nSubmitted job id: " + jobEpr.getActivityUUID());
+		
+		/* wait for termination */
+		while (!besFactory.getActivityStatus(jobEpr).isFinalState()) {
+			System.out.println("Job status: " + besFactory.getActivityStatus(jobEpr));
+			Thread.sleep(1000);
+		}
+		
+		/* terminate job */
+		/* besFactory.terminateActivity(jobEpr); */
+		
+		/* get final status */
+		QCGActivityStatus status =  besFactory.getActivityStatus(jobEpr);
+		
+		if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED)) {
+			System.out.println("Job " + jobEpr.getActivityUUID() + " finished with exit status: " + status.getEndStatus().getExitStatus() );
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FAILED)){
+			System.err.println("Job " + jobEpr.getActivityUUID() + " failed");
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED)){
+			System.err.println("Job " + jobEpr.getActivityUUID() + " was cancelled");
+		}
+		
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/StagInOutMultiuserTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/StagInOutMultiuserTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/StagInOutMultiuserTest.java	(revision 1)
@@ -0,0 +1,49 @@
+package com.qcg.comp.tests;
+
+
+
+import java.io.File;
+import java.io.FileReader;
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class StagInOutMultiuserTest 
+    extends QCGCompConfig
+{
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+	}
+	
+	public void testAttachmentsMultiuserStaging() throws Throwable {
+		
+		JSDL jsdl = new JSDL(new FileReader(getRes("/attachments.xml")));
+		
+		System.err.println("Staging files for: " + username1);
+		jsdl.setUserName(username1);
+		staging.stageInFiles(jsdl);
+		staging.stageOutFiles(jsdl);
+		
+		File stagedOutFile = new File("/tmp/profile.staged");
+		File stagedInFile = new File("/etc/profile");
+		
+		assertFileEquals(stagedInFile, stagedOutFile);
+		stagedOutFile.delete();
+		
+		System.err.println("Staging files for: " + username2);
+		jsdl.setUserName(username2);
+		staging.stageInFiles(jsdl);
+		staging.stageOutFiles(jsdl);
+		
+		assertFileEquals(stagedInFile, stagedOutFile);
+		stagedOutFile.delete();
+		
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARResInfo.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARResInfo.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARResInfo.java	(revision 1)
@@ -0,0 +1,79 @@
+package com.qcg.comp.tests;
+
+
+
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class ARResInfo 
+    extends QCGCompConfig
+{
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+	
+	public void testReservationTwoCpu() throws Exception {
+		long currTime = ((new Date().getTime()) / (60 * 1000)) * 60 * 1000;
+		Date startTime = new Date(currTime + 60 * 1000);
+		Date endTime = new Date(currTime + 2 * 60 * 1000);
+		
+		ARDL ardl = new ARDL(startTime, endTime); // create resr for 120 s; 
+		ardl.setTotalSlotsCount(2);
+		ardl.setUserName(username1);
+		ardl.setName("resName");
+		ardl.setDescription("resDesc");
+		ardl.getCandiateHosts().add(localHostname);
+		
+		System.err.println("Reservation for host: " + localHostname);
+		
+		resEpr1 = ares.createReservation(ardl);
+		System.err.println("Reservation created "+ resEpr1);
+		
+		printReservationStatus(ares.getReservationStatus(resEpr1));
+		assertEquals(1, ares.getReservationStatus(resEpr1).getReservedHost().size());
+		assertTrue(ares.getReservationStatus(resEpr1).getReservedHost().get(0).getHostName().startsWith(localHostname));
+		assertEquals(2, ares.getReservationStatus(resEpr1).getReservedHost().get(0).getReservedSlotsCount().intValue());
+		assertEquals(0, ares.getReservationStatus(resEpr1).getReservedHost().get(0).getUsedSlotsCount().intValue());
+
+		ARDL ardl2 = ares.getReservationDocument(resEpr1).getArdl();
+		
+		assertEquals(startTime, ardl2.getStartTime());
+		assertEquals(endTime, ardl2.getEndTime());
+		
+		System.err.println("Reservation Local Id = " + ares.getReservationDocument(resEpr1).getLocalReservationId());
+		assertNotNull(ares.getReservationDocument(resEpr1).getLocalReservationId());
+
+		List<ReservationEndpointReference> activeReservations = ares.getActiveReservations();
+		
+		assertEquals(1, activeReservations.size());
+		assertEquals(resEpr1, activeReservations.get(0));
+		
+		JSDL jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.getArguments().add("30");
+		jsdl.setUserName(username1);
+		jsdl.setReservationIdentifier(resEpr1);
+
+		jobEpr1 = factory.createActivity(jsdl);
+		
+		waitForState(jobEpr1, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+		assertEquals(1, ares.getReservationStatus(resEpr1).getReservedHost().get(0).getUsedSlotsCount().intValue());
+		List<W3CEndpointReference> aList  = ares.getReservationStatus(resEpr1).getAssociatedActivities().getActivityIdentifier();
+		assertEquals(1,aList.size());
+		assertEquals(jobEpr1, new ActivityEndpointReference(aList.get(0)));
+
+		ares.terminateReservation(resEpr1);
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompSample.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompSample.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompSample.java	(revision 1)
@@ -0,0 +1,53 @@
+package com.qcg.comp.tests;
+
+
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+
+/**
+ * Unit test for simple Job submission.
+ */
+public class QCGCompSample 
+    extends TestCase
+{
+	public static final String QCG_COMPUTING_HOST = "localhost";
+	public static final int QCG_COMPUTING_PORT = 19001;
+	
+	public void testSubmit() throws Exception {
+		QCGFactory besFactory =  new QCGFactory(QCG_COMPUTING_HOST, QCG_COMPUTING_PORT, new AnonymousAuthentication(), false);
+		
+		/* create an JSDL document */
+		JSDL dateJSDL = new JSDL("SimpleJob");
+		
+		dateJSDL.setExecutable("/bin/date");
+		dateJSDL.getArguments().add("-R");
+		dateJSDL.getEnvironment().put("TZ", "Pacific/Honolulu");
+		
+		/* submit a job */
+		ActivityEndpointReference jobEpr = besFactory.createActivity(dateJSDL);
+		
+		/* wait for termination */
+		while (besFactory.getActivityStatus(jobEpr).isFinalState()) { 
+			Thread.sleep(2000);
+		}
+		
+		/* get final status */
+		QCGActivityStatus status =  besFactory.getActivityStatus(jobEpr);
+		
+		if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED)) {
+			System.out.println("Job " + status.getActivityIdentifier() + " finished with exit status: " + status.getEndStatus().getExitStatus() );
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FAILED)){
+			System.err.println("Job " + status.getActivityIdentifier() + " failed");
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED)){
+			System.err.println("Job " + status.getActivityIdentifier() + " was cancelled");
+		}
+		
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompSocksTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompSocksTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompSocksTest.java	(revision 1)
@@ -0,0 +1,31 @@
+package com.qcg.comp.tests;
+
+import static org.junit.Assert.*;
+
+import java.net.InetSocketAddress;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.qcg.comp.sdk.QCGSocks;
+import com.qcg.comp.sdk.socks.SocksSocket;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+
+public class QCGCompSocksTest {
+    
+    protected QCGSocks socks;
+    
+    @Before
+    public void setUp() throws Exception {
+	socks = new QCGSocks("localhost", 19000, new AnonymousAuthentication());
+    }
+    
+    @Test
+    public void getToken() throws Throwable {	
+	SocksSocket socket = new SocksSocket();
+	socket.setProxy(new InetSocketAddress("localhost", 1080));
+	socket.setToken(socks.getToken());
+	socket.connect(new InetSocketAddress("www.man.poznan.pl", 80));
+	assertTrue(socket.isConnected());
+    }
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/TerminateJobMultiuserTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/TerminateJobMultiuserTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/TerminateJobMultiuserTest.java	(revision 1)
@@ -0,0 +1,78 @@
+package com.qcg.comp.tests;
+
+
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class TerminateJobMultiuserTest 
+    extends QCGCompConfig
+{
+	
+	
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	public void testMultiuserSleepKill() throws Throwable {
+		
+		jsdl = new JSDL("sleep");
+		jsdl.setExecutable("/bin/sleep");
+		jsdl.getArguments().add("120");
+		
+		
+		jsdl.setUserName(username1);
+		jobEpr1 = factory.createActivity(jsdl);
+		
+		System.err.println("jobEpr of " + username1  + " = "  + jobEpr1);
+
+		jsdl.setUserName(username2);
+		jobEpr2 = factory.createActivity(jsdl);
+		
+		System.err.println("jobEpr of " + username2  + " = "  + jobEpr2);
+		
+		
+		Future<Object> f1 = pool.submit(new Callable<Object>() {
+
+			public Object call() throws Exception {
+				waitForState(jobEpr2, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+				return null;
+			}
+			
+		});
+		
+		Future<Object> f2 = pool.submit(new Callable<Object>() {
+
+			public Object call() throws Exception {
+				waitForState(jobEpr2, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+				return null;
+			}
+			
+		});
+		
+		f1.get();
+		f2.get();
+		
+		waitForState(jobEpr2, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+		
+		factory.terminateActivity(jobEpr1);
+		factory.terminateActivity(jobEpr2);
+		
+		waitForTermination(jobEpr1);
+		waitForTermination(jobEpr2);
+		
+		assertEquals(factory.getActivityStatus(jobEpr1).getState(), QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED);
+		assertEquals(factory.getActivityStatus(jobEpr2).getState(), QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED);
+
+	}
+
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/JsdlArdlSerializationTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/JsdlArdlSerializationTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/JsdlArdlSerializationTest.java	(revision 1)
@@ -0,0 +1,32 @@
+package com.qcg.comp.tests;
+
+
+
+import java.util.Date;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.jsdl.JSDL;
+
+
+/**
+ * Unit test for simple App.
+ */
+public class JsdlArdlSerializationTest 
+    extends QCGCompConfig
+{
+	
+	public void testARDLJSDL() {
+		
+		JSDL jsdl = new JSDL("test");
+		jsdl.setExecutable("/bin/test");
+		System.err.println("jsdl = " + jsdl);
+
+		ARDL ardl = new ARDL((new Date()));
+		ardl.setTotalSlotsCount(1);
+		ardl.getNativeResources().add("NAMD");
+	
+		System.err.println("ardl = " + ardl);	
+	}
+	
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/UserNameAuthenticationTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/UserNameAuthenticationTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/UserNameAuthenticationTest.java	(revision 1)
@@ -0,0 +1,49 @@
+package com.qcg.comp.tests.authentication;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+import javax.xml.bind.JAXBException;
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.exceptions.CantApplyOperationToCurrentStateException;
+import com.qcg.comp.sdk.exceptions.InvalidRequestMessageException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownActivityIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnsupportedFeatureException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.core.sdk.security.ssl.SSLAuthentication;
+import com.qcg.core.sdk.security.wsse.WSSEAuthentication;
+import com.qcg.core.sdk.security.wsse.username.UsernameToken;
+
+public class UserNameAuthenticationTest extends TestCase {
+	
+	static final String QCG_COMP_HOST = "grass1.man.poznan.pl";
+	
+	static final int QCG_COMP_PORT = 19001;
+	static final String QCG_COMP_DN = "/C=PL/O=GRID/O=PSNC/CN=host/grass1.man.poznan.pl";
+	static final String USERNAME = "mmamonski";
+	static final String PASSWORD = "kafGedEv]";
+	
+	public void testUserNameSSL() throws InvalidRequestMessageException, NotAuthorizedException, UnsupportedFeatureException, JAXBException, CantApplyOperationToCurrentStateException, UnknownActivityIdentifierException, IOException, GeneralSecurityException {
+
+		
+		QCGFactory executionFactory = new QCGFactory(QCG_COMP_HOST, QCG_COMP_PORT, new SSLAuthentication("/etc/grid-security/certificates/8a661490.0", null, QCG_COMP_DN), new WSSEAuthentication(new UsernameToken(USERNAME, PASSWORD, false, false)));
+
+		JSDL jsdl = new JSDL("DateExample");
+		jsdl.setExecutable("/bin/date");
+		
+		ActivityEndpointReference jobEpr = executionFactory.createActivity(jsdl);
+		
+		System.err.println("Submitted activity: " + jobEpr);
+		
+		assertEquals(USERNAME, executionFactory.getActivityDocuments(jobEpr).getJsdl().getUserName());
+		
+		executionFactory.terminateActivity(jobEpr);
+	}
+	
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/GSIAuthenticationTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/GSIAuthenticationTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/GSIAuthenticationTest.java	(revision 1)
@@ -0,0 +1,59 @@
+package com.qcg.comp.tests.authentication;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+import javax.xml.bind.JAXBException;
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.client.QCGComputingClient;
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.exceptions.CantApplyOperationToCurrentStateException;
+import com.qcg.comp.sdk.exceptions.InvalidRequestMessageException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownActivityIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnsupportedFeatureException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.core.sdk.security.gsi.GSIAuthentication;
+import com.qcg.core.sdk.security.ssl.SSLAuthentication;
+import com.qcg.core.sdk.security.wsse.WSSEAuthentication;
+import com.qcg.core.sdk.security.wsse.username.UsernameToken;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
+
+public class GSIAuthenticationTest extends TestCase {
+	
+	static final String QCG_COMP_HOST = "grass1.man.poznan.pl";
+	
+	static final int QCG_COMP_PORT = 19002;
+	static final String QCG_COMP_DN = "/C=PL/O=GRID/O=PSNC/CN=host/grass1.man.poznan.pl";
+	static final int THREADS_COUNT = 2;
+	
+	public void testGSI() throws InvalidRequestMessageException, NotAuthorizedException, UnsupportedFeatureException, JAXBException, CantApplyOperationToCurrentStateException, UnknownActivityIdentifierException, IOException, GeneralSecurityException, InterruptedException {
+
+		QCGComputingClient.initGSICredentials();
+		
+		final QCGFactory executionFactory = new QCGFactory(QCG_COMP_HOST, QCG_COMP_PORT, new GSIAuthentication(QCG_COMP_HOST), true);
+		
+		Thread t[] = new Thread[THREADS_COUNT];
+		
+		for (int i = 0; i < THREADS_COUNT; i++) {
+			t[i] = new Thread() {
+				public void run() {
+					System.err.println(executionFactory.getFactoryAttributesDocument());
+				}
+			};
+			t[i].run();
+			
+		}
+		
+		for (int i=0; i < THREADS_COUNT; i++) {
+			t[i].join();
+		}
+		
+		
+	}
+	
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/AnonymousAuthenticationTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/AnonymousAuthenticationTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/authentication/AnonymousAuthenticationTest.java	(revision 1)
@@ -0,0 +1,59 @@
+package com.qcg.comp.tests.authentication;
+
+import javax.xml.bind.JAXBException;
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.exceptions.CantApplyOperationToCurrentStateException;
+import com.qcg.comp.sdk.exceptions.InvalidRequestMessageException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownActivityIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnsupportedFeatureException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+
+public class AnonymousAuthenticationTest extends TestCase {
+	static final String QCG_COMP_HOST = "grass1.man.poznan.pl";
+	static final int QCG_COMP_PORT_1 = 19001;
+	static final int QCG_COMP_PORT_2 = 19003;
+	static final String USERNAME = "testsuite";
+	
+	public void testFixedMapping() throws InvalidRequestMessageException, NotAuthorizedException, UnsupportedFeatureException, JAXBException, CantApplyOperationToCurrentStateException, UnknownActivityIdentifierException {
+
+		
+		QCGFactory executionFactory = new QCGFactory(QCG_COMP_HOST, QCG_COMP_PORT_1, new AnonymousAuthentication());
+
+		JSDL jsdl = new JSDL("DateExample");
+		jsdl.setExecutable("/bin/date");
+		
+		ActivityEndpointReference jobEpr = executionFactory.createActivity(jsdl);
+		
+		System.err.println("Submitted activity: " + jobEpr);
+		
+		assertEquals(USERNAME, executionFactory.getActivityDocuments(jobEpr).getJsdl().getUserName());
+		
+		executionFactory.terminateActivity(jobEpr);
+	}
+	
+
+	public void testWildcardMapping() throws InvalidRequestMessageException, NotAuthorizedException, UnsupportedFeatureException, JAXBException, CantApplyOperationToCurrentStateException, UnknownActivityIdentifierException {
+
+		
+		QCGFactory executionFactory = new QCGFactory(QCG_COMP_HOST, QCG_COMP_PORT_2, new AnonymousAuthentication());
+
+		JSDL jsdl = new JSDL("DateExample");
+		jsdl.setExecutable("/bin/date");
+		
+		jsdl.setUserName(USERNAME);
+		
+		ActivityEndpointReference jobEpr = executionFactory.createActivity(jsdl);
+		
+		System.err.println("Submitted activity: " + jobEpr);
+		
+		assertEquals(USERNAME, executionFactory.getActivityDocuments(jobEpr).getJsdl().getUserName());
+		
+		executionFactory.terminateActivity(jobEpr);
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARBestEffortMultiuserTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARBestEffortMultiuserTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARBestEffortMultiuserTest.java	(revision 1)
@@ -0,0 +1,101 @@
+package com.qcg.comp.tests;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownReservationIdentifierException;
+import com.qcg.comp.stubs.ares.ARESReservationStatusType;
+import com.qcg.comp.stubs.ares.ARESReservedHostType;
+
+/**
+ * Unit test for simple App.
+ */
+public class ARBestEffortMultiuserTest extends QCGCompConfig
+{
+	
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		
+	}
+	
+	public void testReservationTwoCpu() {
+		
+		try {
+		ARDL ardl = new ARDL(70); // create resr for 70 s; 
+		ardl.setTotalSlotsCount(1);
+		ardl.setAdditionalSlotsCount(2);
+		ardl.setUserName(username1);
+		ardl.setName("RangSlots");
+		resEpr1 = ares.createReservation(ardl);
+		System.err.println("Reservation created " + username1 + " = "  + resEpr1);
+		
+		printReservationStatus(ares.getReservationStatus(resEpr1));
+
+		ARESReservationStatusType resStat =  ares.getReservationStatus(resEpr1);
+		int total = 0;
+		for (ARESReservedHostType rh : resStat.getReservedHost()) {
+			total+=rh.getReservedSlotsCount().intValue();
+		}
+
+		System.err.println("total number of cpus reserved = " + total);
+		
+		assertTrue(total + " >= 1", total >= 1);
+		assertTrue(total + " <= 3", total <= 3);
+		
+		ares.terminateReservation(resEpr1);
+		resEpr1 = null;
+		
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			
+			if (resEpr1 != null) {
+				try {
+					ares.terminateReservation(resEpr1);
+				} catch (NotAuthorizedException e) {
+					e.printStackTrace();
+				} catch (UnknownReservationIdentifierException e) {
+					e.printStackTrace();
+				}
+			}
+			fail();
+		} 
+			
+	}
+	
+	public void testExclusiveReservation() {
+		
+		try {
+			ARDL ardl = new ARDL(70); // create resr for 70 s; 
+			ardl.setTotalSlotsCount(1);
+			ardl.setUserName(username1);
+			ardl.setName("Exclusive Execution");
+			ardl.setExclusiveExecution(true);
+			resEpr1 = ares.createReservation(ardl);
+			System.err.println("Reservation created " + username1 + " = "  + resEpr1);
+			
+			printReservationStatus(ares.getReservationStatus(resEpr1));
+	
+			ARESReservationStatusType resStat =  ares.getReservationStatus(resEpr1);
+			
+			assertEquals(1, resStat.getReservedHost().size());
+			assertEquals(resStat.getReservedHost().get(0).getTotalSlotsCount(), resStat.getReservedHost().get(0).getReservedSlotsCount());
+			
+			ares.terminateReservation(resEpr1);
+			resEpr1 = null;
+			
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			if (resEpr1!= null) {
+				try {
+					ares.terminateReservation(resEpr1);
+				} catch (NotAuthorizedException e) {
+					e.printStackTrace();
+				} catch (UnknownReservationIdentifierException e) {
+					e.printStackTrace();
+				}
+			}
+			fail();
+		} 
+			
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARTwoCpuTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARTwoCpuTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/ARTwoCpuTest.java	(revision 1)
@@ -0,0 +1,69 @@
+package com.qcg.comp.tests;
+
+import java.util.Date;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+/**
+ * Unit test for simple App.
+ */
+public class ARTwoCpuTest extends QCGCompConfig
+{
+ 
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+	
+	public void testReservationTwoCpu() throws Exception {
+
+		try {
+			ARDL ardl = new ARDL(160);
+			ardl.setTotalSlotsCount(2);
+			ardl.setUserName(username1);
+			
+			resEpr1 = ares.createReservation(ardl);
+			
+			System.err.println("Reservation created: " + resEpr1);
+			
+			JSDL jsdl = new JSDL("sleep");
+			jsdl.setExecutable("/bin/sleep");
+			jsdl.getArguments().add("40");
+			jsdl.setUserName(username1);
+			jsdl.setReservationIdentifier(resEpr1);
+			
+			ActivityEndpointReference jobEpr1 = factory.createActivity(jsdl);
+			ActivityEndpointReference jobEpr2 = factory.createActivity(jsdl);
+	
+			System.err.println("Jobs submitted = " + new Date());
+			
+			System.err.println("jobEpr1 = " + jobEpr1);
+			System.err.println("jobEpr2 = " + jobEpr2);
+	
+			waitForState(jobEpr1, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+			System.err.println("Job1 started = " + new Date());
+			
+			waitForState(jobEpr2, QCGActivityStatus.QCG_ACTIVITY_STATE_EXECUTING);
+			System.err.println("Job2 started = " + new Date());
+			
+			
+			waitForTermination(jobEpr1);
+			waitForTermination(jobEpr2);
+	
+			assertEquals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED, factory.getActivityStatus(jobEpr1).getState());
+			assertEquals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED, factory.getActivityStatus(jobEpr1).getState());
+			
+			System.err.println("Job1 finished = " + new Date());
+			System.err.println("Job2 finished = " + new Date());
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			fail();
+		} finally {
+			ares.terminateReservation(resEpr1);
+		}
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompExample.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompExample.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/QCGCompExample.java	(revision 1)
@@ -0,0 +1,56 @@
+package com.qcg.comp.tests;
+
+
+
+import junit.framework.TestCase;
+
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+
+/**
+ * Unit test for simple Job submission.
+ */
+public class QCGCompExample 
+    extends TestCase
+{
+	public static final String QCG_COMPUTING_HOST = "grass1.man.poznan.pl";
+	public static final int QCG_COMPUTING_PORT = 19001;
+	
+	public void testSubmit() throws Exception {
+		QCGFactory besFactory =  new QCGFactory(QCG_COMPUTING_HOST, QCG_COMPUTING_PORT, new AnonymousAuthentication(), true);
+		
+		/* create an JSDL document */
+		JSDL dateJSDL = new JSDL("SimpleJob");
+		
+		dateJSDL.setExecutable("/bin/date");
+		dateJSDL.getArguments().add("-R");
+		dateJSDL.getEnvironment().put("TZ", "Pacific/Honolulu");
+		
+		/* submit a job */
+		ActivityEndpointReference jobEpr = besFactory.createActivity(dateJSDL);
+		
+		/* wait for termination */
+		while (!besFactory.getActivityStatus(jobEpr).isFinalState()) { 
+			Thread.sleep(2000);
+		}
+		
+		/* get final status */
+		QCGActivityStatus status =  besFactory.getActivityStatus(jobEpr);
+		
+		if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED)) {
+			System.out.println("Job " + status.getActivityIdentifier() + " finished with exit status: " + status.getEndStatus().getExitStatus() );
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FAILED)){
+			System.err.println("Job " + status.getActivityIdentifier() + " failed");
+		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED)){
+			System.err.println("Job " + status.getActivityIdentifier() + " was cancelled");
+		}
+		
+	}
+	
+	public static void main(String args[]) throws Exception {
+		(new QCGCompExample()).testSubmit();
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/RsyncStagingTest.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/RsyncStagingTest.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/test/java/com/qcg/comp/tests/RsyncStagingTest.java	(revision 1)
@@ -0,0 +1,294 @@
+package com.qcg.comp.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.qcg.comp.sdk.QCGRsync;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.core.sdk.security.AuthenticationModule;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+import com.sun.xml.internal.rngom.binary.PatternBuilder;
+
+public class RsyncStagingTest {
+
+	protected QCGRsync rsync;
+
+	public static final String baseDir = "/tmp";
+	public static final String aDir = baseDir + "/qcg_rsync_a/";
+	public static final String bDir = baseDir + "/qcg_rsync_b/";
+
+	@Before
+	public void setUp() throws Exception {
+		String hostname = "grass1.man.poznan.pl";
+		int port = 19003;
+		boolean useWSA = true;
+		AuthenticationModule am = new AnonymousAuthentication();
+
+		rsync = new QCGRsync(hostname, port, am, useWSA);
+		new File(aDir).mkdirs();
+		new File(bDir).mkdirs();
+	}
+
+	private void rm(String path) {
+		File f = new File(path);
+		if (f.isDirectory()) {
+			for (String p : f.list())
+				rm(path + "/" + p);
+		}
+		f.delete();
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		rm(aDir);
+		rm(bDir);
+	}
+
+	protected String prepareFile(String basedir, String name, String content)
+			throws FileNotFoundException {
+		new File(basedir).mkdirs();
+		String path = basedir + name;
+		PrintStream p = new PrintStream(new FileOutputStream(path));
+		p.print(content);
+		p.close();
+		return path;
+	}
+
+	protected String getFileContent(String path) throws IOException {
+		FileInputStream f = new FileInputStream(path);
+		byte[] b = new byte[(int) new File(path).length()];
+		f.read(b);
+		f.close();
+		return new String(b);
+	}
+
+	protected void core() throws Throwable {
+		JSDL jsdl = new JSDL("rsync");
+		jsdl.setWorkingDirectory(aDir);
+		rsync.synchronize(jsdl, bDir, null);
+	}
+
+	protected void check(String expected, String file) throws IOException {
+		assertEquals(expected, getFileContent(aDir + "/" + file));
+		assertEquals(expected, getFileContent(bDir + "/" + file));
+	}
+/*
+	@Test
+	public void command0x46() throws Throwable {
+		StringBuffer s = new StringBuffer();
+		for (int i = 0; i < 300; ++i)
+			s.append('a');
+		prepareFile(aDir, "1", s.toString());
+		new File(prepareFile(bDir, "1", s.toString())).setLastModified(0);
+		core();
+		check(s.toString(), "1");
+	}
+
+	@Test
+	public void command0x45() throws Throwable {
+		String prefix = "aaaaaaaaaa";
+		prepareFile(aDir, "1", prefix);
+		new File(prepareFile(bDir, "1", prefix)).setLastModified(0);
+		core();
+		check(prefix, "1");
+	}
+
+	@Test
+	public void command0x49() throws Throwable {
+		StringBuffer aBuf = new StringBuffer();
+		StringBuffer bBuf = new StringBuffer();
+		for (int i = 0; i < 2048; ++i) {
+			aBuf.append('a');
+			bBuf.append('b');
+		}
+		aBuf.append("123");
+		bBuf.append("123");
+		prepareFile(aDir, "1", aBuf.toString());
+		new File(prepareFile(bDir, "1", bBuf.toString())).setLastModified(0);
+		core();
+		check(aBuf.toString(), "1");
+	}
+
+	@Test
+	public void command0x4a() throws Throwable {
+		StringBuffer aBuf = new StringBuffer();
+		StringBuffer bBuf = new StringBuffer();
+		StringBuffer cBuf = new StringBuffer();
+		for (int i = 0; i < 2048; ++i) {
+			aBuf.append('a');
+			bBuf.append('b');
+			cBuf.append('c');
+		}
+		aBuf.append(cBuf);
+		bBuf.append(cBuf);
+		prepareFile(aDir, "1", aBuf.toString());
+		new File(prepareFile(bDir, "1", bBuf.toString())).setLastModified(0);
+		core();
+		check(aBuf.toString(), "1");
+	}
+
+	@Test
+	public void command0x4d() throws Throwable {
+		StringBuffer aBuf = new StringBuffer();
+		StringBuffer bBuf = new StringBuffer();
+		for (int i = 0; i < (1 << 17); ++i) {
+			aBuf.append('a');
+			bBuf.append('b');
+		}
+		aBuf.append("12345");
+		bBuf.append("12345");
+		prepareFile(aDir, "1", aBuf.toString());
+		new File(prepareFile(bDir, "1", bBuf.toString())).setLastModified(0);
+		core();
+		check(aBuf.toString(), "1");
+	}
+
+	@Test
+	public void command0x4e() throws Throwable {
+		StringBuffer aBuf = new StringBuffer();
+		StringBuffer bBuf = new StringBuffer();
+		StringBuffer cBuf = new StringBuffer();
+		for (int i = 0; i < (1 << 17); ++i) {
+			aBuf.append('a');
+			bBuf.append('b');
+		}
+		for (int i = 0; i < 2048; ++i)
+			cBuf.append('c');
+		aBuf.append(cBuf);
+		bBuf.append(cBuf);
+		prepareFile(aDir, "1", aBuf.toString());
+		new File(prepareFile(bDir, "1", bBuf.toString())).setLastModified(0);
+		core();
+		check(aBuf.toString(), "1");
+	}
+
+	@Test
+	public void recv_delta_empty_file() throws Throwable {
+		prepareFile(aDir, "1", "a");
+		new File(prepareFile(bDir, "1", "")).setLastModified(0);
+		core();
+		check("a", "1");
+	}
+
+	@Test
+	public void recv_delta_no_file() throws Throwable {
+		prepareFile(aDir, "1", "a");
+		core();
+		check("a", "1");
+	}
+
+	@Test
+	public void send_delta_empty_file() throws Throwable {
+		prepareFile(bDir, "1", "a");
+		new File(prepareFile(aDir, "1", "")).setLastModified(0);
+		core();
+		check("a", "1");
+	}
+
+	@Test
+	public void send_delta_big_file() throws Throwable {
+		StringBuilder data = new StringBuilder();
+		for (int i = 0; i < 50000; ++i)
+			data.append("a");
+		prepareFile(bDir, "1", data.toString());
+		new File(prepareFile(aDir, "1", "")).setLastModified(0);
+		core();
+		check(data.toString(), "1");
+	}
+
+	@Test
+	public void send_delta_no_file() throws Throwable {
+		prepareFile(bDir, "1", "a");
+		core();
+		check("a", "1");
+	}
+
+	@Test
+	public void two_way() throws Throwable {
+		prepareFile(aDir, "1", "1");
+		prepareFile(bDir, "2", "2");
+		core();
+		check("1", "1");
+		check("2", "2");
+	}
+
+	@Test
+	public void two_way_with_dirs() throws Throwable {
+		prepareFile(aDir + "/1/", "1", "1");
+		prepareFile(bDir + "/2/", "2", "2");
+		core();
+		check("1", "1/1");
+		check("2", "2/2");
+	}
+
+	@Test
+	public void local_to_remote() throws Throwable {
+		prepareFile(aDir, "1", "a");
+		new File(prepareFile(bDir, "1", "b")).setLastModified(0);
+		JSDL jsdl = new JSDL("rsync");
+		jsdl.setWorkingDirectory(aDir);
+		rsync.localToRemote(jsdl, bDir, null);
+		check("b", "1");
+	}
+
+	@Test
+	public void remote_to_local() throws Throwable {
+		new File(prepareFile(aDir, "1", "b")).setLastModified(0);
+		prepareFile(bDir, "1", "");
+		JSDL jsdl = new JSDL("rsync");
+		jsdl.setWorkingDirectory(aDir);
+		rsync.remoteToLocal(jsdl, bDir, null);
+		check("b", "1");
+	}
+
+	@Test
+	public void filtering() throws Throwable {
+		prepareFile(bDir, "1", "a");
+		prepareFile(bDir, "2", "a");
+
+		ArrayList<Pattern> exclude = new ArrayList<Pattern>();
+		exclude.add(Pattern.compile("1"));
+
+		JSDL jsdl = new JSDL("rsync");
+		jsdl.setWorkingDirectory(aDir);
+		rsync.localToRemote(jsdl, bDir, exclude);
+		check("a", "2");
+		assertFalse(new File(aDir + "/1").exists());
+	}
+	*/
+	@Test
+	public void localAndRemoteTest() throws Throwable {
+		prepareFile("/tmp/rsync-local-to-remote/", "1", "a");
+		prepareFile("/tmp/rsync-local-to-remote/", "2", "b");
+		
+		JSDL jsdl = new JSDL("rsync");
+		jsdl.setWorkingDirectory("/home/jkonczak/rtest");
+		
+		//rsync.localToRemote(jsdl, "/tmp/rsync-local-to-remote/", null);
+		ArrayList<Pattern> pattern = new ArrayList<Pattern>();
+		pattern.add(Pattern.compile("\\..*"));
+		System.err.println(jsdl);
+		System.err.println("syncing with: " + jsdl.getWorkingDirectory());
+		rsync.localToRemote(jsdl, "/tmp/rtest", pattern);
+		rsync.remoteToLocal(jsdl, "/tmp/rtest2", pattern);
+
+		
+		assertEquals("a", getFileContent("/tmp/rsync-remote-to-local/" + "1"));
+		assertEquals("b", getFileContent("/tmp/rsync-remote-to-local/" + "2"));
+
+
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/bindings/global-jaxb.xml
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/bindings/global-jaxb.xml	(revision 9)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/bindings/global-jaxb.xml	(revision 1)
@@ -4,5 +4,5 @@
   <bindings scd="x-schema::tns" xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/">
       <schemaBindings>
-         <package name="org.qcg.comp.stubs.soap" />
+         <package name="com.qcg.comp.stubs.soap" />
       </schemaBindings>
    </bindings>
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-socks.wsdl
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-socks.wsdl	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-socks.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/qcg-comp-socks.wsdl
+link ../../../../../../../schemas/interface/smoa-comp-socks.wsdl
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-factory.xsd
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-factory.xsd	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/jsdl-qcg-comp-factory.xsd
+link ../../../../../../../schemas/interface/jsdl-smoa-comp-factory.xsd
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-ares.wsdl
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-ares.wsdl	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-ares.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/qcg-comp-ares.wsdl
+link ../../../../../../../schemas/interface/smoa-comp-ares.wsdl
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-staging.wsdl
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-staging.wsdl	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-staging.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/qcg-comp-staging.wsdl
+link ../../../../../../../schemas/interface/smoa-comp-staging.wsdl
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-factory.xsd
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-factory.xsd	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/qcg-comp-factory.xsd
+link ../../../../../../../schemas/interface/smoa-comp-factory.xsd
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-rsync.wsdl
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-rsync.wsdl	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-rsync.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/qcg-comp-rsync.wsdl
+link ../../../../../../../schemas/interface/smoa-comp-rsync.wsdl
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-ares.xsd
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-ares.xsd	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/jsdl-qcg-comp-ares.xsd
+link ../../../../../../../schemas/interface/jsdl-smoa-comp-ares.xsd
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-staging.xsd
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-staging.xsd	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/jsdl-qcg-comp-staging.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/jsdl-qcg-comp-staging.xsd
+link ../../../../../../../schemas/interface/jsdl-smoa-comp-staging.xsd
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-ares.xsd
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-ares.xsd	(revision 2)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../../../../schemas/interface/qcg-comp-ares.xsd
+link ../../../../../../../schemas/interface/smoa-comp-ares.xsd
Index: trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-monitoring.xsd
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/resources/schemas/qcg-comp-monitoring.xsd	(revision 65)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../../../../../../schemas/interface/qcg-comp-monitoring.xsd
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/client/QCGComputingClient.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/client/QCGComputingClient.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/client/QCGComputingClient.java	(revision 1)
@@ -0,0 +1,651 @@
+package com.qcg.comp.client;
+
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.security.auth.login.CredentialException;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.globus.gsi.GlobusCredential;
+import org.gridforum.jgss.ExtendedGSSManager;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+
+import com.qcg.comp.sdk.ARES;
+import com.qcg.comp.sdk.QCGFactory;
+import com.qcg.comp.sdk.QCGManagement;
+import com.qcg.comp.sdk.QCGRsync;
+import com.qcg.comp.sdk.QCGStaging;
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.exceptions.CantApplyOperationToCurrentStateException;
+import com.qcg.comp.sdk.exceptions.DeleteOnTerminationException;
+import com.qcg.comp.sdk.exceptions.FileNotFoundException;
+import com.qcg.comp.sdk.exceptions.InvalidRequestMessageException;
+import com.qcg.comp.sdk.exceptions.NoMatchingResourcesException;
+import com.qcg.comp.sdk.exceptions.NoSlotsAvailableException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.StagingException;
+import com.qcg.comp.sdk.exceptions.UnknownActivityIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnknownReservationIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnsupportedFeatureException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+import com.qcg.comp.stubs.ares.ARESReservationStatusType;
+import com.qcg.comp.stubs.ares.ObjectFactory;
+import com.qcg.comp.stubs.bes.factory.FactoryResourceAttributesDocumentType;
+import com.qcg.comp.stubs.rsync.IOFault;
+import com.qcg.comp.stubs.rsync.InternalFault;
+import com.qcg.comp.stubs.rsync.InvalidPathFault;
+import com.qcg.comp.stubs.rsync.RsyncFault;
+import com.qcg.comp.stubs.staging.FileNotFoundFault;
+import com.qcg.comp.stubs.staging.NotAuthorizedFault;
+import com.qcg.comp.stubs.staging.StagingFault;
+import com.qcg.core.sdk.attachments.SimpleFileStagingHandler;
+import com.qcg.core.sdk.security.AuthenticationModule;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
+import com.qcg.core.sdk.security.gsi.GSIAuthentication;
+import com.qcg.core.sdk.security.ssl.SSLAuthentication;
+import com.qcg.core.sdk.security.wsse.WSSEAuthentication;
+import com.qcg.core.sdk.security.wsse.username.UsernameToken;
+import com.qcg.core.sdk.utils.EndpointReferenceUtils;
+
+public class QCGComputingClient {
+
+	public static final String DEFAULT_SERVICE_URL = "http://localhost:19000/";
+	
+	static boolean debug = Boolean.parseBoolean(System.getProperty("qcg.debug", "false"));
+	boolean wsa = Boolean.parseBoolean(System.getProperty("qcg.wsa", "true"));
+	String serviceURL = System.getProperty("qcg.comp.service.url", DEFAULT_SERVICE_URL);
+	String username = System.getProperty("qcg.comp.username");
+	String password = System.getProperty("qcg.comp.password");
+	String caFile = System.getProperty("qcg.comp.ca.file");
+	String caPath = System.getProperty("qcg.comp.ca.path");
+	String trustedDN = System.getProperty("qcg.comp.trustedDN");
+	String clientCertKey = System.getProperty("qcg.comp.client.certkey");
+	String clientCertPass = System.getProperty("qcg.comp.client.keypass");
+	int repeat = Integer.parseInt(System.getProperty("qcg.repeat.count", "1"));
+	
+	String jsdlContent;
+	String jsdlFile;
+	String resUUID;
+	String resEprFile;
+	String actUUID;
+	String actEprFile;
+	String resdocContent;
+	String resdocFile;
+	ArrayList<String> rsyncLocal = new ArrayList<String>();
+	ArrayList<String> rsyncExclude = new ArrayList<String>();
+	ACTION action = ACTION.n_NONE;
+	
+	QCGFactory besFactory;
+	QCGManagement besManagement;
+	ARES ares;
+	QCGStaging staging;
+	QCGRsync rsync;
+	
+	public QCGComputingClient(String[] args) {
+		
+	    	boolean parseArgs = true;
+	    
+		String actionStr = args[0].substring(1,2);								
+		
+		for (int i=1; i < args.length; i++) {	
+		    
+		    	if(parseArgs) {
+        			if (args[i].equals("-j"))
+        				jsdlContent = args[++i];
+        			
+        			else if (args[i].equals("-J"))
+        				jsdlFile = args[++i];
+        			
+        			else if (args[i].equals("-r"))
+        				resUUID = args[i+1];
+        			
+        			else if (args[i].equals("-R"))
+        				resEprFile = args[i+1];
+        			
+        			else if (args[i].equals("-a"))
+        				actUUID = args[i+1];
+        			
+        			else if (args[i].equals("-A"))
+        				actEprFile = args[i+1];
+        			
+        			else if (args[i].equals("-d"))
+        				resdocContent = args[i+1];
+        			
+        			else if (args[i].equals("-D"))
+        				resdocFile = args[i+1];
+        			
+        			else if (args[i].equals("-X"))
+        			    	rsyncExclude.add(args[++i]);
+        			
+        			else if (args[i].equals("--"))
+        			    	parseArgs = false;
+        			
+        			else
+        			    	rsyncLocal.add(args[i]);
+		    	}
+		    	else
+			    	rsyncLocal.add(args[i]);
+		}
+		
+		//simple vaidation:
+		if (jsdlContent != null && jsdlFile!= null)
+			throw new IllegalArgumentException("only one of the -j/-J options may be given");
+		
+		if (resUUID != null && resEprFile!= null)
+			throw new IllegalArgumentException("only one of the -r/-R options may be given");
+		
+		if (actUUID != null && actEprFile!= null)
+			throw new IllegalArgumentException("only one of the -a/-A options may be given");
+		
+		if (resdocContent != null && resdocFile!= null)
+			throw new IllegalArgumentException("only one of the -d/-D options may be given");
+		
+		for (ACTION a : ACTION.values()) {
+			if (a.name().startsWith(actionStr)) {
+				action = a;
+				break;
+			}
+		}
+		
+		if (action == ACTION.n_NONE) {
+			throw new IllegalArgumentException("No action specified");
+		}
+	}
+	
+	public static void initGSICredentials() {
+		ExtendedGSSManager manager = (ExtendedGSSManager) ExtendedGSSManager
+				.getInstance();
+
+		try {
+			manager.createCredential(GSSCredential.INITIATE_AND_ACCEPT);
+		} catch (GSSException e) {
+			org.globus.tools.ProxyInit.main(new String[] {});
+		}
+	}
+	
+	/*
+	public static void loadCredential() throws CredentialException
+	{
+		int tryCount = 0;
+		ExtendedGSSManager manager = (ExtendedGSSManager)ExtendedGSSManager.getInstance();
+		
+		do
+		{
+			try
+			{
+				String proxy = System.getenv("X509_USER_PROXY");
+				logDebug("proxy = " + proxy);
+				
+				if( proxy!=null && !proxy.isEmpty())
+				{
+					GlobusCredential gcredential = new GlobusCredential( proxy);
+					credential = new GlobusGSSCredentialImpl(gcredential, GSSCredential.INITIATE_AND_ACCEPT);
+				}
+				else
+					credential = manager.createCredential( GSSCredential.INITIATE_AND_ACCEPT);
+				
+				break;
+			}
+			catch( Exception e)
+			{
+				if( tryCount == 0)
+				{
+					ProxyInit.run();
+					tryCount++;
+					continue;
+				}
+					
+				throw new CredentialException( e.getMessage(), e);
+			}
+		}
+		while( tryCount < 2);
+	}
+	*/
+	
+	public void execute() throws Exception {
+		
+		if (debug)
+			System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
+		//setup ports:
+		
+		AuthenticationModule transportAM = null;
+		AuthenticationModule messageAM =  null;
+		
+		
+		System.err.println("Service URL = " + serviceURL);
+		
+		boolean gsiEnabled = (serviceURL.startsWith("httpg://")); /* ugly hack on httpg */
+		if (gsiEnabled)
+			serviceURL = serviceURL.replaceFirst("httpg", "https");
+		
+		URL sURL = new URL(serviceURL);
+		
+		String host = sURL.getHost();
+		int port = sURL.getPort();
+		String protocol = sURL.getProtocol();
+		
+		if (protocol.equals("http")) {
+			//http
+			transportAM =  new AnonymousAuthentication();
+		} else if (protocol.equals("https") && !gsiEnabled) {
+			//SSL
+			if (clientCertKey != null) {
+				//mutual
+				transportAM = new SSLAuthentication(caFile, caPath, clientCertKey, clientCertPass, trustedDN);
+			} else {
+				transportAM = new SSLAuthentication(caFile, caPath, trustedDN);
+			}
+			 
+		} else if (protocol.equals("https") && gsiEnabled) {
+			//GSI
+			//
+			if (System.getenv("X509_USER_PROXY") != null && !System.getenv("X509_USER_PROXY").isEmpty()) {
+				transportAM = new GSIAuthentication(System.getenv("X509_USER_PROXY"), trustedDN);
+			} else {
+				initGSICredentials();
+				transportAM = new GSIAuthentication(trustedDN);
+			}
+		}else {
+			throw new IllegalArgumentException("Unknown protocol: " + protocol);
+		}
+		
+		if (username != null) {
+			messageAM =  new WSSEAuthentication(new UsernameToken(username, password, false, false));
+		}
+		
+		besFactory = new QCGFactory(host, port, transportAM,messageAM, wsa);
+		besManagement =  new QCGManagement(host, port, transportAM, messageAM, wsa);
+		ares = new ARES(host, port, transportAM, messageAM, wsa);
+		staging = new QCGStaging(host, port, transportAM, messageAM, wsa, new SimpleFileStagingHandler());
+		rsync = new QCGRsync(host, port, transportAM, messageAM, wsa);
+		
+		for (int i =0; i < repeat; i++) {
+			switch (action) {
+	
+				case c_CREATE:
+					
+					if (jsdlContent!= null || jsdlFile != null) {
+						createActivity();
+					} else if (resdocContent!=null || resdocFile != null) {
+						createReservation();
+					} else {
+						throw new IllegalArgumentException("Missing argument");
+					}
+					
+					break;
+				case s_GET_STATUS:
+					
+					if (actUUID!= null || actEprFile != null)
+						getActivityStatus();
+					else if (resUUID!=null || resEprFile != null)
+						getReservationStatus();
+					else
+						throw new IllegalArgumentException("Missing argument");
+					
+					
+					break;
+					
+				case t_TERMINATE:
+					
+					if (actUUID!= null || actEprFile != null)
+						terminateActivity();
+					else if (resUUID!=null || resEprFile != null)
+						terminateReservation();
+					else
+						throw new IllegalArgumentException("Missing argument");
+					
+					break;
+					
+				case e_ENABLE_SUB:
+					
+					enableSub();
+					
+					break;
+				case d_DISABLE_SUB:
+					
+					disableSub();
+					
+					break;
+				case g_GET_DOC:
+					
+					if (actUUID!= null || actEprFile != null)
+						getActivityDoc();
+					else if (resUUID!=null || resEprFile != null)
+						getReservationDoc();
+					else
+						throw new IllegalArgumentException("Missing argument");
+					
+					break;
+				case G_GET_FACT_DOC:
+					getFactoryDoc();
+					break;
+				case l_LIST_RES:
+					listReservations();
+					break;
+				case i_STAGE_IN:
+					stageIn();
+					break;
+				case o_STAGE_OUT:
+					stageOut();
+					break;
+				case L_RSYNC_LOCAL:
+				    	rsyncLocal();
+				    	break;
+				default:
+					usage();
+					break;
+				}
+		}
+	}
+	
+	private void rsyncLocal() throws NoSuchAlgorithmException, InternalFault, InvalidPathFault, DatatypeConfigurationException, IOException, IOFault, RsyncFault, JAXBException, FileNotFoundFault, NotAuthorizedFault, StagingFault {
+	    JSDL jsdl = null;
+		
+	    log(jsdlContent);
+	    
+	    if (jsdlContent != null)
+		jsdl = new JSDL(new StringReader(jsdlContent));
+	    else if (jsdlFile != null)
+		jsdl = new JSDL(new FileReader(jsdlFile));
+	    else
+	    	throw new IllegalArgumentException("Missing JSDL argument");
+	    	
+	    for(String local : rsyncLocal) {
+		System.out.println("Syncing from "+local+" to "+serviceURL+":"+jsdl.getWorkingDirectory());
+		rsync.rsyncLocalToRemote(jsdl, local, rsyncExclude);
+	    }
+	}
+
+	private void stageOut() throws JAXBException,  IOException, DeleteOnTerminationException, FileNotFoundException, NotAuthorizedException, StagingException {
+		JSDL jsdl = null;
+		
+		if (jsdlContent != null)
+			jsdl = new JSDL(new StringReader(jsdlContent));
+		else if (jsdlFile != null)
+			jsdl = new JSDL(new FileReader(jsdlFile));
+		else
+			throw new IllegalArgumentException("Missing JSDL argument");
+		
+		staging.stageOutFiles(jsdl);
+	}
+
+	private void stageIn() throws JAXBException, IOException, FileNotFoundException, NotAuthorizedException, StagingException {
+		JSDL jsdl = null;
+		
+		if (jsdlContent != null)
+			jsdl = new JSDL(new StringReader(jsdlContent));
+		else if (jsdlFile != null)
+			jsdl = new JSDL(new FileReader(jsdlFile));
+		else
+			throw new IllegalArgumentException("Missing JSDL argument");
+		
+		staging.stageInFiles(jsdl);
+	}
+
+	private void listReservations() throws NotAuthorizedException {
+		List<ReservationEndpointReference> activeRes = ares.getActiveReservations();
+		int i = 0;
+		
+		for (ReservationEndpointReference rEpr : activeRes) {
+			i++;
+			System.err.println("ActiveReservation[" + i + "]=" + rEpr.getReservationUUID());
+		}
+	}
+
+	private void getFactoryDoc() throws JAXBException {
+		System.err.println("FactoryAttributes[" + serviceURL + "]:");
+		
+		FactoryResourceAttributesDocumentType frad =  besFactory.getFactoryAttributesDocument();
+		
+		Marshaller m = besFactory.getJaxbContext().createMarshaller();
+		StringWriter sw  = new StringWriter(512);
+		m.setProperty("jaxb.formatted.output",new Boolean(true)); 
+		m.marshal((new com.qcg.comp.stubs.bes.factory.ObjectFactory()).createFactoryResourceAttributesDocument(frad), sw);
+		System.err.println(sw.getBuffer().toString());
+	}
+
+	private void getReservationDoc() throws IOException, NotAuthorizedException, UnknownReservationIdentifierException {
+		ReservationEndpointReference rer = null;
+		
+		if (resUUID != null) {
+			rer = new ReservationEndpointReference(serviceURL, resUUID);
+		} else if (resEprFile != null){
+			rer = new ReservationEndpointReference(EndpointReferenceUtils.loadFromFile(resEprFile));
+		} else {
+			throw new IllegalArgumentException("Missing reservation identifier");
+		}
+		
+		System.err.println("reservation documents[" + rer.getReservationUUID() + "]:");
+		System.err.println(ares.getReservationDocument(rer));		
+	}
+
+	private void getActivityDoc() throws IOException, NotAuthorizedException, UnknownActivityIdentifierException {
+		ActivityEndpointReference aer = null;
+		
+		if (actUUID != null) {
+			aer = new ActivityEndpointReference(serviceURL, actUUID);
+		} else if (actEprFile != null){
+			aer = new ActivityEndpointReference(EndpointReferenceUtils.loadFromFile(actEprFile));
+		} else {
+			throw new IllegalArgumentException("Missing activity identifier");
+		}
+		
+		System.err.println("activity documents[" + aer.getActivityUUID() + "]:");
+		System.err.println(besFactory.getActivityDocuments(aer));
+	}
+
+	private void disableSub() throws NotAuthorizedException {
+		besManagement.stopAcceptingNewActivites();
+	}
+
+	private void enableSub() throws NotAuthorizedException {
+		besManagement.startAcceptingNewActivites();
+	}
+
+	private void createReservation() throws JAXBException, IOException, InvalidRequestMessageException, NoMatchingResourcesException, NoSlotsAvailableException, NotAuthorizedException, UnsupportedFeatureException {
+		ARDL resDoc = null;
+		
+		if (resdocContent != null)
+			resDoc = new ARDL(new StringReader(resdocContent));
+		else if (resdocFile != null)
+			resDoc = new ARDL(new FileReader(resdocFile));
+		else
+			throw new IllegalArgumentException("Missing ARDL argument");
+		
+		ReservationEndpointReference epr = ares.createReservation(resDoc);
+		log("Reservation created.");
+		
+		if (resEprFile != null) {
+			EndpointReferenceUtils.saveToFile(epr.getEndpointReference(), resEprFile);
+			log("Reservation EPR saved in " + resEprFile);
+		} else {
+			log("Reservation UUID: " + epr.getReservationUUID());
+		}
+	}
+	
+	private void terminateReservation() throws IOException, NotAuthorizedException, UnknownReservationIdentifierException {
+		ReservationEndpointReference rer = null;
+		
+		if (resUUID != null) {
+			rer = new ReservationEndpointReference(serviceURL, resUUID);
+		} else if (resEprFile != null){
+			rer = new ReservationEndpointReference(EndpointReferenceUtils.loadFromFile(resEprFile));
+		} else {
+			throw new IllegalArgumentException("Missing reservation identifier");
+		}
+		
+		System.err.println("terminating reservation[" + rer.getReservationUUID() + "]");
+		ares.terminateReservation(rer);
+	}
+
+	private void terminateActivity() throws IOException, CantApplyOperationToCurrentStateException, NotAuthorizedException, UnknownActivityIdentifierException {
+		ActivityEndpointReference aer = null;
+		
+		if (actUUID != null) {
+			aer = new ActivityEndpointReference(serviceURL, actUUID);
+		} else if (actEprFile != null){
+			aer = new ActivityEndpointReference(EndpointReferenceUtils.loadFromFile(actEprFile));
+		} else {
+			throw new IllegalArgumentException("Missing activity identifier");
+		}
+		
+		System.err.println("terminating activity[" + aer.getActivityUUID() + "]");
+		System.err.println("terminated = " + besFactory.terminateActivity(aer));
+	}
+
+	private void getActivityStatus() throws IOException, NotAuthorizedException, UnknownActivityIdentifierException {
+		ActivityEndpointReference aer = null;
+		
+		if (actUUID != null) {
+			aer = new ActivityEndpointReference(serviceURL, actUUID);
+		} else if (actEprFile != null){
+			aer = new ActivityEndpointReference(EndpointReferenceUtils.loadFromFile(actEprFile));
+		} else {
+			throw new IllegalArgumentException("Missing activity identifier");
+		}
+		
+		System.err.println("Status of activity[" + aer.getActivityUUID() + "]: " + besFactory.getActivityStatus(aer));
+	}
+	
+	private void getReservationStatus() throws IOException, JAXBException, NotAuthorizedException, UnknownReservationIdentifierException {
+		ReservationEndpointReference rer = null;
+		
+		if (resUUID != null) {
+			rer = new ReservationEndpointReference(serviceURL, resUUID);
+		} else if (resEprFile != null){
+			rer = new ReservationEndpointReference(EndpointReferenceUtils.loadFromFile(resEprFile));
+		} else {
+			throw new IllegalArgumentException("Missing reservation identifier");
+		}
+		
+		ARESReservationStatusType rstat = ares.getReservationStatus(rer);
+		
+		System.err.println("Status of reservation[" + rer.getReservationUUID() + "]: ");
+		
+		Marshaller m = ares.getJaxbContext().createMarshaller();
+		m.setProperty("jaxb.formatted.output", new Boolean(true)); 
+
+		StringWriter sw = new StringWriter(512);
+		m.marshal((new ObjectFactory()).createReservationStatus(rstat), sw);
+		System.err.println(sw.getBuffer().toString());
+	}
+
+	private void createActivity() throws JAXBException, IOException, InvalidRequestMessageException, NotAuthorizedException, UnsupportedFeatureException {
+		JSDL jsdl = null;
+		ReservationEndpointReference resEpr = null;
+		
+		if (jsdlContent != null)
+			jsdl = new JSDL(new StringReader(jsdlContent));
+		else if (jsdlFile != null)
+			jsdl = new JSDL(new FileReader(jsdlFile));
+		else
+			throw new IllegalArgumentException("Missing JSDL argument");
+		
+		if (resEprFile != null) {
+			resEpr = new ReservationEndpointReference(new FileInputStream(resEprFile));
+		} else if (resUUID != null) {
+			resEpr = new ReservationEndpointReference(serviceURL, resUUID);
+		}
+		
+		if (resEpr!= null)
+			jsdl.setReservationIdentifier(resEpr);
+		
+		ActivityEndpointReference epr = besFactory.createActivity(jsdl);
+		log("Activity created.");
+		
+		if (actEprFile != null) {
+			EndpointReferenceUtils.saveToFile(epr.getEndpointReference(), actEprFile);
+			log("Activity EPR saved in " + actEprFile);
+		} else {
+			log("Activity UUID: " + epr.getActivityUUID());
+		}
+	}
+
+	public static void main(String[] args) {
+		try {
+			QCGComputingClient client = new QCGComputingClient(args);
+			client.execute();
+		} catch (IndexOutOfBoundsException ex) {
+			log("Illegal usage!");
+			usage();
+		} catch (IllegalArgumentException ex) {
+			log(ex.getMessage());
+			usage();			
+		} catch (Exception ex) {
+			System.err.println(ex);
+			if (debug)
+				ex.printStackTrace();
+		}
+	}
+	
+	public static void usage() {
+		log("Usage: java -jar QCGComputingSDK-2.2.jar OPTIONS");
+		log("");
+		log("BES-Factory port usage:");
+		log("  -c (-j jsdl|-J jsdl.xml) [-r reservationUUID|-R reservation-epr.xml] [-A activity-epr.xml]");
+		log("                                                    create activity, optionally save activity EPR to file");
+		log("  -s (-a activityUUID|-A activity-epr.xml)          check status of the activity");
+		log("  -g (-a activityUUID|-A activity-epr.xml)          get activity document");
+		log("  -t (-a activityUUID|-A activity-epr.xml)          terminate activity");
+		log("  -G                                                get factory document");						
+		log("");
+		log("BES-Management port usage:");
+		log("  -e                                                enable submission");
+		log("  -d                                                disable submission");
+		log("");
+		log("QCG-ARES port usage:");
+		log("  -c (-d ardl|-D ardl.xml) [-R reservation-epr.xml]");
+		log("                                                    create reservation, optionally save reservation EPR to file");
+		log("  -s (-r reservationUUID|-R reservation-epr.xml)    check status of the reservation");
+		log("  -g (-r reservationUUID|-R reservation-epr.xml)    get reservation document");
+		log("  -t (-r reservationUUID|-R reservation-epr.xml)    terminate reservation");
+		log("  -l                                                list active reservations");
+		log("");
+		log("QCG-Staging port usage:");
+		log("  -i (-j jsdl|-J jsdl.xml)                          stage files in");
+		log("  -o (-j jsdl|-J jsdl.xml)                          stage files out");
+		log("");
+		log("QCG-Rsync port usage:");
+		log("  -L (-j jsdl|-J jsdl.xml)                          rsync files from local site (updates remote site)");
+		log("");
+		log("  -h                                                print this information");
+		log("");
+		log("Optional VM args:");
+		log("  -Dqcg.comp.service.url=URL                       service url (default: " + DEFAULT_SERVICE_URL + ")");
+		log("  -Dqcg.debug=true                                 turn on debugging (default: off)");
+		log("  -Dqcg.wsa=false                                  turn off WS-Addressing headers (default: on)");
+		log("  -Dqcg.comp.username=user                         username (WSSE UserName Token profile - HTTP/HTTPS)");
+		log("  -Dqcg.comp.password=pass                         user's password (WSSE UserName Token profile - HTTP/HTTPS)");
+		log("  -Dqcg.comp.ca.file=file                          path to CA certificate (HTTPS)");
+		log("  -Dqcg.comp.ca.path=dir                           path to  directory with CA certificates (HTTPS) ");
+		log("  -Dqcg.comp.trustedDN=\"C=PL..\"                  expected Distinguished Name of the service (HTTPS/HTTPG)");
+		log("  -Dqcg.comp.client.certkey=file                   path to file with client key and certificate (HTTPS)");
+		log("  -Dqcg.comp.client.keypass=pass                   key's passphrase (HTTPS)");
+
+
+
+	}
+	
+	private enum ACTION { n_NONE, c_CREATE, s_GET_STATUS, t_TERMINATE, e_ENABLE_SUB, d_DISABLE_SUB, g_GET_DOC, G_GET_FACT_DOC, l_LIST_RES, i_STAGE_IN, o_STAGE_OUT, h_HELP, L_RSYNC_LOCAL} ;
+	
+	public static void log(String msg) {
+		System.err.println(msg);
+	}
+	
+	public static void logDebug(String msg) {
+		if (debug)
+			System.err.println(msg);
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/DeleteOnTerminationException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/DeleteOnTerminationException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/DeleteOnTerminationException.java	(revision 1)
@@ -0,0 +1,32 @@
+package com.qcg.comp.sdk.exceptions;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class DeleteOnTerminationException extends QCGCompException {
+	protected List<String> filesList = new LinkedList<String>();
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public DeleteOnTerminationException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.staging.DeleteOnTerminationFault) {
+			com.qcg.comp.stubs.staging.DeleteOnTerminationFault f = (com.qcg.comp.stubs.staging.DeleteOnTerminationFault)ex;
+			for (Object o :  f.getFaultInfo().getContent()) {
+				filesList.add(o.toString());
+			}
+			setInfoMessage(filesList);
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+	public List<String> getFilesList(){
+		return filesList;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/QCGCompException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/QCGCompException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/QCGCompException.java	(revision 1)
@@ -0,0 +1,69 @@
+package com.qcg.comp.sdk.exceptions;
+
+import java.util.List;
+
+public class QCGCompException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+	protected String infoMessage;
+
+	public QCGCompException() {
+		super();
+	}
+
+	public QCGCompException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+	public QCGCompException(String arg0) {
+		super(arg0);
+	}
+
+	public QCGCompException(Throwable arg0) {
+		super(arg0);
+	}
+	
+	protected void setInfoMessage(List<String> list){
+		if (list.size()!=0) {
+			StringBuffer sb = new StringBuffer(128 * list.size());
+
+			for (String el: list) {
+				if (sb.length() != 0)
+					sb.append(',');
+				
+				sb.append(el);
+			}
+			
+			infoMessage = sb.toString();
+		}
+	}
+	
+	protected void setInfoMessage(String message, List<String> list){
+		if (list.size()!=0) {
+			StringBuffer sb = new StringBuffer(128 * list.size());
+
+			for (String el: list) {
+				if (sb.length() != 0)
+					sb.append(',');
+				
+				sb.append(el);
+			}
+			
+			infoMessage = message + " - " + sb.toString();
+		} else {
+			infoMessage = message;
+		}
+	}
+	
+	public String getInfoMessage() {
+		return infoMessage;
+	}
+	
+	@Override
+	public String getMessage() {
+		if (infoMessage == null)
+			return super.getMessage();
+		else
+			return super.getMessage() + " : " +  infoMessage;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NotAceptingNewActivitiesException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NotAceptingNewActivitiesException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NotAceptingNewActivitiesException.java	(revision 1)
@@ -0,0 +1,21 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class NotAceptingNewActivitiesException extends QCGCompException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public NotAceptingNewActivitiesException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.bes.factory.NotAcceptingNewActivitiesFault) {
+			//TODO: marshal any
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/FileNotFoundException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/FileNotFoundException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/FileNotFoundException.java	(revision 1)
@@ -0,0 +1,26 @@
+package com.qcg.comp.sdk.exceptions;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class FileNotFoundException extends QCGCompException {
+	protected List<String> filesList = new LinkedList<String>();
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public FileNotFoundException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.staging.FileNotFoundFault) {
+			com.qcg.comp.stubs.staging.FileNotFoundFault f = (com.qcg.comp.stubs.staging.FileNotFoundFault)ex;
+			infoMessage = f.getFaultInfo().getValue();
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/StagingException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/StagingException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/StagingException.java	(revision 1)
@@ -0,0 +1,26 @@
+package com.qcg.comp.sdk.exceptions;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class StagingException extends QCGCompException {
+	protected List<String> filesList = new LinkedList<String>();
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public StagingException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.staging.StagingFault) {
+			com.qcg.comp.stubs.staging.StagingFault f = (com.qcg.comp.stubs.staging.StagingFault)ex;
+			infoMessage = f.getFaultInfo().getValue();
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NotAuthorizedException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NotAuthorizedException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NotAuthorizedException.java	(revision 1)
@@ -0,0 +1,31 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class NotAuthorizedException extends QCGCompException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public NotAuthorizedException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.bes.factory.NotAuthorizedFault) {
+			//com.qcg.comp.stubs.bes.factory.NotAuthorizedFault f = (com.qcg.comp.stubs.bes.factory.NotAuthorizedFault)ex;
+			//TODO: marshal any
+		} else if (ex instanceof com.qcg.comp.stubs.bes.management.NotAuthorizedFault) {
+			//com.qcg.comp.stubs.bes.management.NotAuthorizedFault f = (com.qcg.comp.stubs.bes.management.NotAuthorizedFault)ex;
+			//TODO: marshal any
+		} else if (ex instanceof com.qcg.comp.stubs.ares.NotAuthorizedFault) {
+			//com.qcg.comp.stubs.ares.NotAuthorizedFault f = (com.qcg.comp.stubs.ares.NotAuthorizedFault)ex;
+			//TODO: marshal any
+		} else if (ex instanceof com.qcg.comp.stubs.staging.NotAuthorizedFault) {
+			//com.qcg.comp.stubs.staging.NotAuthorizedFault f = (com.qcg.comp.stubs.staging.NotAuthorizedFault)ex;
+			//TODO: marshal any
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnknownActivityIdentifierException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnknownActivityIdentifierException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnknownActivityIdentifierException.java	(revision 1)
@@ -0,0 +1,27 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class UnknownActivityIdentifierException extends QCGCompException {
+	protected String customMessage;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public UnknownActivityIdentifierException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.bes.factory.UnknownActivityIdentifierFault) {
+			com.qcg.comp.stubs.bes.factory.UnknownActivityIdentifierFault f = (com.qcg.comp.stubs.bes.factory.UnknownActivityIdentifierFault)ex;
+			customMessage = f.getFaultInfo().getMessage();
+			infoMessage = customMessage;
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+	public String getCustomMessage(){
+		return customMessage;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NoMatchingResourcesException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NoMatchingResourcesException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NoMatchingResourcesException.java	(revision 1)
@@ -0,0 +1,21 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class NoMatchingResourcesException extends QCGCompException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public NoMatchingResourcesException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.ares.NoMatchingResourcesFault) {
+			//TODO: marshal any
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NoSlotsAvailableException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NoSlotsAvailableException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/NoSlotsAvailableException.java	(revision 1)
@@ -0,0 +1,21 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class NoSlotsAvailableException extends QCGCompException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public NoSlotsAvailableException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.ares.NoSlotsAvailableFault) {
+			//TODO: marshal any
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/CantApplyOperationToCurrentStateException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/CantApplyOperationToCurrentStateException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/CantApplyOperationToCurrentStateException.java	(revision 1)
@@ -0,0 +1,28 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+
+public class CantApplyOperationToCurrentStateException extends QCGCompException {
+	protected QCGActivityStatus status;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public CantApplyOperationToCurrentStateException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.bes.factory.CantApplyOperationToCurrentStateFault) {
+			com.qcg.comp.stubs.bes.factory.CantApplyOperationToCurrentStateFault f = (com.qcg.comp.stubs.bes.factory.CantApplyOperationToCurrentStateFault)ex;
+			status = new QCGActivityStatus(null, f.getFaultInfo().getActivityStatus());
+			infoMessage = f.getFaultInfo().getMessage() + " (current state = " + status.toString() + ")";
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+	public QCGActivityStatus getCurrentStatus(){
+		return status;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/InvalidRequestMessageException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/InvalidRequestMessageException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/InvalidRequestMessageException.java	(revision 1)
@@ -0,0 +1,33 @@
+package com.qcg.comp.sdk.exceptions;
+
+import java.util.List;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class InvalidRequestMessageException extends QCGCompException {
+	protected List<String> invalidElements;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public InvalidRequestMessageException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.bes.factory.InvalidRequestMessageFault) {
+			com.qcg.comp.stubs.bes.factory.InvalidRequestMessageFault f = (com.qcg.comp.stubs.bes.factory.InvalidRequestMessageFault)ex;
+			invalidElements = f.getFaultInfo().getInvalidElement();
+			setInfoMessage(f.getFaultInfo().getMessage(), f.getFaultInfo().getInvalidElement());
+		} else if (ex instanceof com.qcg.comp.stubs.ares.InvalidRequestMessageFault) {
+			com.qcg.comp.stubs.ares.InvalidRequestMessageFault f = (com.qcg.comp.stubs.ares.InvalidRequestMessageFault)ex;
+			invalidElements = f.getFaultInfo().getInvalidElement();
+			setInfoMessage(f.getFaultInfo().getMessage(), f.getFaultInfo().getInvalidElement());
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+	public List<String> getInvalidElements(){
+		return invalidElements;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnknownReservationIdentifierException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnknownReservationIdentifierException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnknownReservationIdentifierException.java	(revision 1)
@@ -0,0 +1,27 @@
+package com.qcg.comp.sdk.exceptions;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class UnknownReservationIdentifierException extends QCGCompException {
+	protected String customMessage;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public UnknownReservationIdentifierException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.ares.UnknownReservationIdentifierFault) {
+			com.qcg.comp.stubs.ares.UnknownReservationIdentifierFault f = (com.qcg.comp.stubs.ares.UnknownReservationIdentifierFault)ex;
+			customMessage = f.getFaultInfo().getMessage();
+			infoMessage = customMessage;
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+	public String getCustomMessage(){
+		return customMessage;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnsupportedFeatureException.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnsupportedFeatureException.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/exceptions/UnsupportedFeatureException.java	(revision 1)
@@ -0,0 +1,33 @@
+package com.qcg.comp.sdk.exceptions;
+
+import java.util.List;
+
+import com.qcg.comp.sdk.exceptions.QCGCompException;
+
+public class UnsupportedFeatureException extends QCGCompException {
+	protected List<String> features;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public UnsupportedFeatureException(Throwable ex) {
+		super(ex.getMessage(), ex);
+		
+		if (ex instanceof com.qcg.comp.stubs.bes.factory.UnsupportedFeatureFault) {
+			com.qcg.comp.stubs.bes.factory.UnsupportedFeatureFault f = (com.qcg.comp.stubs.bes.factory.UnsupportedFeatureFault)ex;
+			features = f.getFaultInfo().getFeature();
+			setInfoMessage(f.getFaultInfo().getFeature());
+		} else if (ex instanceof com.qcg.comp.stubs.ares.UnsupportedFeatureFault) {
+			com.qcg.comp.stubs.ares.UnsupportedFeatureFault f = (com.qcg.comp.stubs.ares.UnsupportedFeatureFault)ex;
+			features = f.getFaultInfo().getFeature();
+			setInfoMessage(f.getFaultInfo().getFeature());
+		} else {
+			throw new AssertionError(ex);
+		}
+	}
+	
+	public List<String> getFeatures(){
+		return features;
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGFactory.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGFactory.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGFactory.java	(revision 1)
@@ -0,0 +1,284 @@
+package com.qcg.comp.sdk;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import com.qcg.comp.sdk.exceptions.CantApplyOperationToCurrentStateException;
+import com.qcg.comp.sdk.exceptions.InvalidRequestMessageException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownActivityIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnsupportedFeatureException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.jsdl.JSDLDataStaging;
+import com.qcg.comp.sdk.types.ActivityDocument;
+import com.qcg.comp.sdk.types.ActivityEndpointReference;
+import com.qcg.comp.sdk.types.QCGActivityStatus;
+import com.qcg.comp.stubs.bes.factory.ActivityDocumentType;
+import com.qcg.comp.stubs.bes.factory.BESFactory;
+import com.qcg.comp.stubs.bes.factory.BESFactoryPortType;
+import com.qcg.comp.stubs.bes.factory.CantApplyOperationToCurrentStateFault;
+import com.qcg.comp.stubs.bes.factory.CreateActivityResponseType;
+import com.qcg.comp.stubs.bes.factory.CreateActivityType;
+import com.qcg.comp.stubs.bes.factory.FactoryResourceAttributesDocumentType;
+import com.qcg.comp.stubs.bes.factory.GetActivityDocumentResponseType;
+import com.qcg.comp.stubs.bes.factory.GetActivityDocumentsResponseType;
+import com.qcg.comp.stubs.bes.factory.GetActivityDocumentsType;
+import com.qcg.comp.stubs.bes.factory.GetActivityStatusResponseType;
+import com.qcg.comp.stubs.bes.factory.GetActivityStatusesResponseType;
+import com.qcg.comp.stubs.bes.factory.GetActivityStatusesType;
+import com.qcg.comp.stubs.bes.factory.GetFactoryAttributesDocumentResponseType;
+import com.qcg.comp.stubs.bes.factory.GetFactoryAttributesDocumentType;
+import com.qcg.comp.stubs.bes.factory.InvalidRequestMessageFault;
+import com.qcg.comp.stubs.bes.factory.NotAcceptingNewActivitiesFault;
+import com.qcg.comp.stubs.bes.factory.NotAuthorizedFault;
+import com.qcg.comp.stubs.bes.factory.TerminateActivitiesResponseType;
+import com.qcg.comp.stubs.bes.factory.TerminateActivitiesType;
+import com.qcg.comp.stubs.bes.factory.TerminateActivityResponseType;
+import com.qcg.comp.stubs.bes.factory.UnknownActivityIdentifierFault;
+import com.qcg.comp.stubs.bes.factory.UnsupportedFeatureFault;
+import com.qcg.comp.stubs.factory.ApplicationsType;
+import com.qcg.comp.stubs.hpcp.bf.BasicFilterType;
+import com.qcg.core.sdk.QCGCoreService;
+import com.qcg.core.sdk.security.AuthenticationModule;
+
+public class QCGFactory extends QCGCoreService {
+	public static final String BES_FACTORY_NS = "http://schemas.ggf.org/bes/2006/08/bes-factory";
+	protected BESFactoryPortType besFactory;
+	
+	public QCGFactory(String hostname, int port, 
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer,
+			boolean useWSA) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer, useWSA);
+		
+		besFactory = (BESFactoryPortType)stubs;
+	}
+	
+	public QCGFactory(String hostname, int port, 
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer);
+		
+		besFactory = (BESFactoryPortType)stubs;
+	}
+	
+	public QCGFactory(String hostname, int port, 
+			AuthenticationModule transportLayer,
+			boolean useWSA) throws JAXBException {
+		super(hostname, port, transportLayer, useWSA);
+		
+		besFactory = (BESFactoryPortType)stubs;
+	}
+	
+	public QCGFactory(String hostname, int port, 
+			AuthenticationModule transportLayer) throws JAXBException {
+		super(hostname, port, transportLayer);
+		
+		besFactory = (BESFactoryPortType)stubs;
+	}
+	@Override
+	protected Service getService(){
+
+		return new BESFactory(QCGFactory.class.getResource("/schemas/bes-factory.wsdl"), new QName(BES_FACTORY_NS, "BESFactory"));
+	}
+	
+	@Override
+	@SuppressWarnings("all")
+	protected List<Handler> getHandlersChain() {
+		return null;
+	}
+
+	@Override
+	protected Object getPort(Service service, WebServiceFeature... features) {
+		return ((BESFactory)service).getBESFactory(features);
+	}
+		
+	public synchronized ActivityEndpointReference createActivity(JSDL jsdl) throws InvalidRequestMessageException, NotAuthorizedException, UnsupportedFeatureException {
+		CreateActivityType parameters =  new CreateActivityType();
+		JSDL jsdlCopy = null;
+		
+		try {
+			jsdlCopy = (JSDL)jsdl.clone();
+		} catch (CloneNotSupportedException e) {
+			e.printStackTrace();
+			throw new AssertionError();
+		}
+		
+		List<JSDLDataStaging> toRemove = new LinkedList<JSDLDataStaging>();
+		
+		for (JSDLDataStaging ds:  jsdlCopy.getDataStaging()) {
+			if (ds.getSourceURL() != null  && (!ds.getSourceURL().contains(":") || ds.getSourceURL().startsWith("cid:")))
+				toRemove.add(ds);
+			
+			if (ds.getTargetURL() != null  && !ds.getTargetURL().contains(":"))
+				toRemove.add(ds);
+		}
+		
+		jsdlCopy.getDataStaging().removeAll(toRemove);
+		
+		parameters.setActivityDocument(new ActivityDocumentType());
+		parameters.getActivityDocument().setJobDefinition(jsdlCopy.toJobDefinition()); 
+		
+		CreateActivityResponseType response;
+		try {
+			response = besFactory.createActivity(parameters);
+		} catch (InvalidRequestMessageFault e) {
+			throw new InvalidRequestMessageException(e);
+		} catch (NotAcceptingNewActivitiesFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnsupportedFeatureFault e) {
+			throw new UnsupportedFeatureException(e);
+		}
+		
+		return new ActivityEndpointReference(response.getActivityIdentifier());
+	}
+	
+	public synchronized QCGActivityStatus getActivityStatus(ActivityEndpointReference activityIdentifier) throws NotAuthorizedException, UnknownActivityIdentifierException {
+		
+		return getActivityStatuses(getSingleElemList(activityIdentifier)).get(0);
+	}
+	
+	public synchronized List<QCGActivityStatus> getActivityStatuses(List<ActivityEndpointReference> activityIdentifiers) throws NotAuthorizedException, UnknownActivityIdentifierException {
+		GetActivityStatusesType parameters =  new GetActivityStatusesType();
+		parameters.getActivityIdentifier().addAll(convert(activityIdentifiers));
+		
+		
+		GetActivityStatusesResponseType response;
+		try {
+			response = besFactory.getActivityStatuses(parameters);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnknownActivityIdentifierFault e) {
+			throw new UnknownActivityIdentifierException(e);
+		}
+		
+		List<QCGActivityStatus> activitiesStatus = new ArrayList<QCGActivityStatus>(response.getResponse().size());
+		
+		for (GetActivityStatusResponseType activityStat : response.getResponse()) {
+			activitiesStatus.add(new QCGActivityStatus(activityStat.getActivityIdentifier(), activityStat.getActivityStatus()));
+		}
+		
+		return activitiesStatus;
+	}
+	
+	public synchronized boolean terminateActivity(ActivityEndpointReference activityIdentifier) throws CantApplyOperationToCurrentStateException, NotAuthorizedException, UnknownActivityIdentifierException {
+		
+		return terminateActivites(getSingleElemList(activityIdentifier)).get(0);
+	}
+	
+	public synchronized List<Boolean> terminateActivites(List<ActivityEndpointReference> activityIdentifiers) throws CantApplyOperationToCurrentStateException, NotAuthorizedException, UnknownActivityIdentifierException {
+		TerminateActivitiesType parameters =  new TerminateActivitiesType();
+		parameters.getActivityIdentifier().addAll(convert(activityIdentifiers));
+		List<Boolean> termStatus = new ArrayList<Boolean>(activityIdentifiers.size());
+		
+		TerminateActivitiesResponseType response;
+		try {
+			response = besFactory.terminateActivities(parameters);
+		} catch (CantApplyOperationToCurrentStateFault e) {
+			throw new CantApplyOperationToCurrentStateException(e);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnknownActivityIdentifierFault e) {
+			throw new UnknownActivityIdentifierException(e);
+		}
+		
+		for (TerminateActivityResponseType res : response.getResponse()) {
+				if (res.getFault() != null) {
+					termStatus.add(new Boolean(false));
+				} else if (res.isTerminated()) {
+					termStatus.add(new Boolean(true));
+				} else {
+					termStatus.add(new Boolean(false));
+				}
+		}
+		
+		return termStatus;
+		
+	}
+	
+	public synchronized List<ActivityDocument> getActivitiesDocuments(List<ActivityEndpointReference> activitiesIdentifier) throws NotAuthorizedException, UnknownActivityIdentifierException {
+		GetActivityDocumentsType parameters = new GetActivityDocumentsType();
+		parameters.getActivityIdentifier().addAll(convert(activitiesIdentifier));
+		
+		GetActivityDocumentsResponseType response;
+		try {
+			response = besFactory.getActivityDocuments(parameters);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnknownActivityIdentifierFault e) {
+			throw new UnknownActivityIdentifierException(e);
+		}
+		
+		ArrayList<ActivityDocument> dList =  new ArrayList<ActivityDocument>();
+		
+		for ( GetActivityDocumentResponseType res : response.getResponse()) {
+			dList.add(new ActivityDocument(new JSDL(res.getJobDefinition()), res.getLocalActivityId()));
+		}
+		
+		return dList;
+	}
+
+	public synchronized ActivityDocument getActivityDocuments(ActivityEndpointReference activityIdentifier) throws NotAuthorizedException, UnknownActivityIdentifierException {
+		
+		return getActivitiesDocuments(getSingleElemList(activityIdentifier)).get(0);
+	}
+	
+	public synchronized FactoryResourceAttributesDocumentType getFactoryAttributesDocument() {
+		GetFactoryAttributesDocumentType parameters = new GetFactoryAttributesDocumentType();
+		GetFactoryAttributesDocumentResponseType response = besFactory.getFactoryAttributesDocument(parameters);
+		
+		return response.getFactoryResourceAttributesDocument();
+	}
+	
+	public synchronized static ApplicationsType getApplications(FactoryResourceAttributesDocumentType factoryDoc) {
+		for (Object any : factoryDoc.getAny()) {
+			if (any instanceof JAXBElement && ((JAXBElement) any).getDeclaredType().equals(ApplicationsType.class)) {
+				return ((ApplicationsType)((JAXBElement) any).getValue());
+			}
+		}
+		
+		return null;
+	}
+	
+	public synchronized FactoryResourceAttributesDocumentType getFactoryAttributesDocument(boolean returnActivities, boolean returnResources) {
+		GetFactoryAttributesDocumentType parameters = new GetFactoryAttributesDocumentType();
+		
+		parameters.setBasicFilter(new BasicFilterType());
+		parameters.getBasicFilter().setActivityReferences(returnActivities);
+		parameters.getBasicFilter().setContainedResources(returnResources);
+		
+		GetFactoryAttributesDocumentResponseType response = besFactory.getFactoryAttributesDocument(parameters);
+		
+		return response.getFactoryResourceAttributesDocument();
+	}
+	
+	protected synchronized List<ActivityEndpointReference> getSingleElemList(ActivityEndpointReference activityIdentifier) {
+
+		List<ActivityEndpointReference> aiList = new ArrayList<ActivityEndpointReference>();
+		aiList.add(activityIdentifier);
+		
+		return aiList;
+	}
+	
+	protected synchronized List<W3CEndpointReference> convert(List<ActivityEndpointReference> activitiesIdentifier) {
+		List<W3CEndpointReference> w3cList = new ArrayList<W3CEndpointReference>(activitiesIdentifier.size());
+		
+		for (ActivityEndpointReference aer : activitiesIdentifier) {
+			w3cList.add(aer.getEndpointReference(getURL()));
+		}
+		
+		return w3cList;
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/ardl/ARDL.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/ardl/ARDL.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/ardl/ARDL.java	(revision 1)
@@ -0,0 +1,565 @@
+package com.qcg.comp.sdk.ardl;
+
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+
+import com.qcg.comp.stubs.ares.ardl.ARDLCandidateHostsType;
+import com.qcg.comp.stubs.ares.ardl.ARDLFileSystemType;
+import com.qcg.comp.stubs.ares.ardl.ARDLNativeResourceType;
+import com.qcg.comp.stubs.ares.ardl.ARDLReservationDefinitionType;
+import com.qcg.comp.stubs.ares.ardl.ARDLReservationDescriptionType;
+import com.qcg.comp.stubs.ares.ardl.ARDLReservationIdentificationType;
+import com.qcg.comp.stubs.ares.ardl.ARDLResourcesType;
+import com.qcg.comp.stubs.ares.ardl.ARDLTimeWindowType;
+import com.qcg.comp.stubs.ares.ardl.ObjectFactory;
+import com.qcg.comp.stubs.jsdl.CPUArchitectureType;
+import com.qcg.comp.stubs.jsdl.FileSystemTypeEnumeration;
+import com.qcg.comp.stubs.jsdl.OperatingSystemType;
+import com.qcg.comp.stubs.jsdl.OperatingSystemTypeEnumeration;
+import com.qcg.comp.stubs.jsdl.OperatingSystemTypeType;
+import com.qcg.comp.stubs.jsdl.ProcessorArchitectureEnumeration;
+
+public class ARDL implements Serializable, Cloneable {
+	
+	/**
+	 * ver 2.0
+	 */
+	private static final long serialVersionUID = 210L;
+
+	protected static JAXBContext jaxbCtxt;
+	protected static DatatypeFactory datatypeFactory;
+	
+	protected transient ARDLReservationDefinitionType resDefinition;
+	protected String resString;
+	
+	protected String name;
+	protected String description;
+	protected List<String> candiateHosts = new ArrayList<String>() ;
+
+	protected boolean openWindow = false;
+	protected boolean strictWindow = true;
+
+	protected Date startTime;
+	protected Date endTime;
+	protected Duration duration; 
+	
+	protected boolean exclusiveExecution;
+	protected OperatingSystemTypeEnumeration operatingSystem;
+	protected ProcessorArchitectureEnumeration CPUArchitecture;
+	protected Integer totalSlotsCount;
+	protected Integer additionalSlotsCount;
+	protected Integer individualPhysicalMemory;
+	protected Integer individualSwapMemory;
+	protected Long individualTmpSpace;
+	protected Long individualHomeSpace;
+	protected String userName;
+	protected String groupName;
+	protected List<String> nativeResources =  new ArrayList<String>();
+	
+	public List<String> getNativeResources() {
+		invalidate();
+		
+		return nativeResources;
+	}
+	
+	protected static synchronized JAXBContext getJAXBContext() throws JAXBException {
+		
+		if (jaxbCtxt == null) {
+			jaxbCtxt = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
+		}
+		
+		return jaxbCtxt;
+	}
+	
+	protected static synchronized DatatypeFactory getDatatypeFactory()  {
+		
+		if (datatypeFactory == null) {
+			try {
+				datatypeFactory = DatatypeFactory.newInstance();
+			} catch (DatatypeConfigurationException e) {
+				e.printStackTrace();
+			}
+		}
+		
+		return datatypeFactory;
+	}
+	
+	protected void invalidate() {
+		resDefinition = null;
+		resString = null;
+	}
+	
+	protected void convertToReservationDefinition() {
+		if (resDefinition != null)
+			return;
+		
+		resDefinition = new ARDLReservationDefinitionType();
+		DatatypeFactory df = getDatatypeFactory();
+		
+		
+		ARDLReservationDescriptionType rd =  new ARDLReservationDescriptionType();
+		resDefinition.setReservationDescription(rd);
+		
+		rd.setTimeWindow(new ARDLTimeWindowType());
+		
+		//identification
+		if (name!= null) {
+			rd.setReservationIdentification(new ARDLReservationIdentificationType());
+			rd.getReservationIdentification().setReservationName(name);
+			
+			if (description != null) {
+				rd.getReservationIdentification().setDescription(description);
+			}
+			
+		}
+		
+		//time window
+		if (startTime != null) {
+			GregorianCalendar gc  = new GregorianCalendar();
+			gc.setTime(startTime);
+			rd.getTimeWindow().setStartTime(df.newXMLGregorianCalendar(gc));
+		}
+		
+		if (endTime != null) {
+			GregorianCalendar gc  = new GregorianCalendar();
+			gc.setTime(endTime);
+			rd.getTimeWindow().setEndTime(df.newXMLGregorianCalendar(gc));
+		}
+		
+		if (duration != null) {
+			rd.getTimeWindow().setDuration(duration);
+		}
+		
+		//resources
+		ARDLResourcesType r = new ARDLResourcesType();
+		rd.setResources(r);
+		
+		
+		if (exclusiveExecution) {
+			r.setExclusiveExecution(exclusiveExecution);
+		}
+		
+		if (operatingSystem != null) {
+			r.setOperatingSystem(new OperatingSystemType());
+			r.getOperatingSystem().setOperatingSystemType(new OperatingSystemTypeType());
+			r.getOperatingSystem().getOperatingSystemType().setOperatingSystemName(operatingSystem);
+		}
+		
+		if (CPUArchitecture != null) {
+			r.setCPUArchitecture(new CPUArchitectureType());
+			r.getCPUArchitecture().setCPUArchitectureName(CPUArchitecture);
+		}
+
+		if (totalSlotsCount != null) {
+			r.setReservedSlotsCount(BigInteger.valueOf(totalSlotsCount.longValue()));
+		}
+		
+		if (additionalSlotsCount != null) {
+			r.setAdditionalReservedSlotsCount(BigInteger.valueOf(additionalSlotsCount.longValue()));
+		}
+			
+		if (individualPhysicalMemory != null) {
+			r.setIndividualPhysicalMemory(BigInteger.valueOf(individualPhysicalMemory.longValue()));
+		}
+		
+		if (individualSwapMemory != null) {
+			r.setIndividualSwapMemory(BigInteger.valueOf(individualSwapMemory.longValue()));
+		}
+		
+		if (individualHomeSpace != null) {
+			ARDLFileSystemType afs = new ARDLFileSystemType();
+			afs.setType(FileSystemTypeEnumeration.NORMAL);
+			afs.setValue(BigInteger.valueOf(individualHomeSpace));
+			r.getFileSystem().add(afs);
+		}
+		
+		if (individualTmpSpace != null) {
+			ARDLFileSystemType afs = new ARDLFileSystemType();
+			afs.setType(FileSystemTypeEnumeration.TEMPORARY);
+			afs.setValue(BigInteger.valueOf(individualTmpSpace));
+			r.getFileSystem().add(afs);
+		}
+		
+		if (userName != null) {
+			r.setUserName(userName);
+		}
+		
+		if (groupName != null) {
+			r.setGroupName(groupName);
+		}
+		
+		if (candiateHosts.size() != 0) {
+			r.setCandidateHosts(new ARDLCandidateHostsType());
+			
+			for (String host : candiateHosts) 
+				r.getCandidateHosts().getHostName().add(host);
+		}
+		
+		if (openWindow)
+			rd.getTimeWindow().setOpen(new Boolean(true));
+		
+		if (!strictWindow)
+			rd.getTimeWindow().setStrict(new Boolean(false));
+		else 
+			rd.getTimeWindow().setStrict(new Boolean(true));
+
+		
+		if (nativeResources.size() !=0) {
+			for (String nr : nativeResources) {
+				ARDLNativeResourceType nrt = new ARDLNativeResourceType();
+				String splitted[] = nr.split("=");
+				nrt.setName(splitted[0]);
+
+				if (splitted.length == 2) {
+					nrt.setValue(splitted[1]);
+				} else {
+					nrt.setValue(null);
+				}
+				
+				r.getNativeResource().add(nrt);
+			}
+		}
+		
+	}
+	
+	protected void convertFromReservationDefinition() {
+		ARDLReservationDescriptionType rd  = resDefinition.getReservationDescription();
+		
+		//identification
+		if (rd.getReservationIdentification() != null) {
+			name = rd.getReservationIdentification().getReservationName();
+			description = (rd.getReservationIdentification().getDescription() != null ? rd.getReservationIdentification().getDescription() : null);
+		}
+		
+		//time window
+		
+		if (rd.getTimeWindow().getStartTime() != null)
+			startTime = rd.getTimeWindow().getStartTime().toGregorianCalendar().getTime();
+		
+		if (rd.getTimeWindow().getEndTime() != null)
+			endTime = rd.getTimeWindow().getEndTime().toGregorianCalendar().getTime();
+		
+		duration = rd.getTimeWindow().getDuration();
+		
+		//resources;
+		ARDLResourcesType r = rd.getResources();
+		
+		
+		exclusiveExecution = r.isExclusiveExecution() == null ? false : r.isExclusiveExecution();
+		
+		operatingSystem = r.getOperatingSystem() == null || 
+			r.getOperatingSystem().getOperatingSystemType() == null ? null : r.getOperatingSystem().getOperatingSystemType().getOperatingSystemName();
+		CPUArchitecture = r.getCPUArchitecture() == null ? null : r.getCPUArchitecture().getCPUArchitectureName();
+		
+		totalSlotsCount = r.getReservedSlotsCount() == null ? null : r.getReservedSlotsCount().intValue();
+		additionalSlotsCount = r.getReservedSlotsCount() == null ? null : r.getReservedSlotsCount().intValue();
+		
+		individualPhysicalMemory = r.getIndividualPhysicalMemory() == null ? null : r.getIndividualPhysicalMemory().intValue();
+		individualSwapMemory = r.getIndividualPhysicalMemory() == null ? null : r.getIndividualPhysicalMemory().intValue();
+		
+		for (int i = 0; i < r.getFileSystem().size(); i++) {
+			ARDLFileSystemType fst = r.getFileSystem().get(i);
+			
+			if (fst.getType().equals(FileSystemTypeEnumeration.NORMAL)) {
+				individualHomeSpace = fst.getValue().longValue();
+			} else if (fst.getType().equals(FileSystemTypeEnumeration.TEMPORARY)) {
+				individualTmpSpace = fst.getValue().longValue();
+			} else {
+				throw new IllegalArgumentException("Unsupported file system type: " + fst.getType().value());
+			}
+			
+		}
+		
+		
+		userName = r.getUserName();
+		groupName = r.getGroupName();
+		
+		if (r.getCandidateHosts() !=  null) {
+			for (String hostname : r.getCandidateHosts().getHostName()) {
+				candiateHosts.add(hostname);
+			}
+		}
+		
+		openWindow = rd.getTimeWindow().isOpen();
+		strictWindow = rd.getTimeWindow().isStrict();
+		
+		for (int i=0; i < rd.getResources().getNativeResource().size(); i++ ) {
+			String name = rd.getResources().getNativeResource().get(i).getName();
+			String value = rd.getResources().getNativeResource().get(i).getValue();
+			String cat = name;
+			
+			if (value!= null && (!"".equals(value))) {
+				cat+=("=" + name);
+			}
+			nativeResources.add(cat);
+		}
+	}
+	
+	public ARDL(Date endTime) {
+		this.endTime = endTime;
+	}
+	
+	public ARDL(Date startTime, Date endTime) {
+		this.startTime = startTime;
+		this.endTime = endTime;
+	}
+	
+	public ARDL(Duration duration) {
+		this.duration = duration;
+	}
+	
+	public ARDL(int duration) {
+		this.duration = getDatatypeFactory().newDuration(duration * 1000);
+	}
+	
+	public ARDL(ARDLReservationDefinitionType ar) {
+		this.resDefinition = ar;
+		
+		convertFromReservationDefinition();
+	}
+	
+	@SuppressWarnings("unchecked")
+	public ARDL(Reader reader) throws JAXBException {
+		Unmarshaller um = getJAXBContext().createUnmarshaller();
+		resDefinition = ((JAXBElement<ARDLReservationDefinitionType>) um.unmarshal(reader)).getValue();
+		
+		convertFromReservationDefinition();
+	}
+	
+	public ARDLReservationDefinitionType getReservationDefinition() {
+		convertToReservationDefinition();
+		
+		return resDefinition;
+	}
+
+
+	public void setReservationDefinition(ARDLReservationDefinitionType resDefinition) {
+		invalidate();
+		
+		this.resDefinition = resDefinition;
+	}
+
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		invalidate();
+		
+		this.name = name;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		invalidate();
+		
+		this.description = description;
+	}
+
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		invalidate();
+		
+		this.startTime = startTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		invalidate();
+		
+		this.endTime = endTime;
+	}
+
+	public Duration getDuration() {
+		return duration;
+	}
+
+	public void setDuration(Duration duration) {
+		invalidate();
+		
+		this.duration = duration;
+	}
+
+	public boolean isExclusiveExecution() {
+		return exclusiveExecution;
+	}
+
+	public void setExclusiveExecution(boolean exclusiveExecution) {
+		invalidate();
+
+		this.exclusiveExecution = exclusiveExecution;
+	}
+
+	public OperatingSystemTypeEnumeration getOperatingSystem() {
+		return operatingSystem;
+	}
+
+	public void setOperatingSystem(OperatingSystemTypeEnumeration operatingSystem) {
+		invalidate();
+
+		this.operatingSystem = operatingSystem;
+	}
+
+	public ProcessorArchitectureEnumeration getCPUArchitecture() {
+		return CPUArchitecture;
+	}
+
+	public void setCPUArchitecture(ProcessorArchitectureEnumeration architecture) {
+		invalidate();
+
+		CPUArchitecture = architecture;
+	}
+
+	public Integer getTotalSlotsCount() {
+		return totalSlotsCount;
+	}
+
+	public void setTotalSlotsCount(Integer totalSlotsCount) {
+		invalidate();
+
+		this.totalSlotsCount = totalSlotsCount;
+	}
+
+	public Integer getIndividualPhysicalMemory() {
+		return individualPhysicalMemory;
+	}
+
+	public void setIndividualPhysicalMemory(Integer individualPhysicalMemory) {
+		invalidate();
+
+		this.individualPhysicalMemory = individualPhysicalMemory;
+	}
+
+	public Integer getIndividualSwapMemory() {
+		return individualSwapMemory;
+	}
+
+	public void setIndividualSwapMemory(Integer individualSwapMemory) {
+		invalidate();
+
+		this.individualSwapMemory = individualSwapMemory;
+	}
+
+	public Long getIndividualHomeSpace() {
+		return individualHomeSpace;
+	}
+
+	public void setIndividualHomeSpace(Long individualHomeSpace) {
+		invalidate();
+
+		this.individualHomeSpace = individualHomeSpace;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		invalidate();
+
+		this.userName = userName;
+	}
+
+	public String getGroupName() {
+		return groupName;
+	}
+
+	public void setGroupName(String groupName) {
+		invalidate();
+
+		this.groupName = groupName;
+	}
+
+	public List<String> getCandiateHosts() {
+		invalidate();
+		
+		return candiateHosts;
+	}
+	
+	public Integer getAdditionalSlotsCount() {
+		return additionalSlotsCount;
+	}
+
+	public void setAdditionalSlotsCount(Integer additionalSlotsCount) {
+		invalidate();
+		
+		this.additionalSlotsCount = additionalSlotsCount;
+	}
+	
+	public boolean isOpenWindow() {
+		return openWindow;
+	}
+
+	public void setOpenWindow(boolean openWindow) {
+		invalidate();
+		
+		this.openWindow = openWindow;
+	}
+	
+	public boolean isStrictWindow() {
+		return strictWindow;
+	}
+
+	public void setStrictWindow(boolean strictWindow) {
+		invalidate();
+		this.strictWindow = strictWindow;
+	}
+
+	@Override
+	public String toString() {
+		try {
+			if (resString == null) {
+				convertToReservationDefinition();
+				Marshaller m = getJAXBContext().createMarshaller();
+				m.setProperty("jaxb.formatted.output",new Boolean(true)); 
+				StringWriter sw  = new StringWriter(512);
+				m.marshal((new ObjectFactory()).createReservationDefinition(resDefinition), sw);
+				resString = sw.getBuffer().toString();
+			}
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			resString = "Unable to marshal JSDL:" + ex.getMessage();
+		}
+		
+		return resString;
+	}
+	
+	@Override
+	public Object clone() throws CloneNotSupportedException {
+		String ardlStr = this.toString();
+		try {
+			return new ARDL(new StringReader(ardlStr));
+		} catch (JAXBException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/socks/SocksSocket.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/socks/SocksSocket.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/socks/SocksSocket.java	(revision 1)
@@ -0,0 +1,48 @@
+package com.qcg.comp.sdk.socks;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+
+public class SocksSocket extends Socket {
+        
+    protected SocketAddress proxy;
+    protected String token;
+    
+    public SocksSocket() {
+	
+    }
+    
+    public void setProxy(InetSocketAddress proxy) {
+	this.proxy = proxy;
+    }
+    
+    public void setToken(String token) {
+	this.token = token;
+    }
+    
+    protected void negotiate(InetSocketAddress endpoint) throws IOException {
+	byte[] request = new byte[]{0x04,0x01};
+	byte[] response = new byte[8];
+	int pos = 0;
+	
+	this.getOutputStream().write(request);	
+	this.getOutputStream().write(endpoint.getPort()>>8);
+	this.getOutputStream().write(endpoint.getPort());
+	this.getOutputStream().write(endpoint.getAddress().getAddress());
+	this.getOutputStream().write(token.getBytes());
+	this.getOutputStream().write(0);
+	
+	while(pos < 8)
+	    pos += this.getInputStream().read(response, pos, 8-pos);
+	
+	if(response[0] != 0 || response[1] != 90)
+	    throw new IOException("Socks server returned garbage");
+    }
+    
+    public void connect(InetSocketAddress endpoint) throws IOException { 	
+	super.connect(proxy);
+	negotiate(endpoint);
+    }
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ReservationEndpointReference.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ReservationEndpointReference.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ReservationEndpointReference.java	(revision 1)
@@ -0,0 +1,121 @@
+package com.qcg.comp.sdk.types;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import com.qcg.core.sdk.utils.EndpointReferenceUtils;
+
+public class ReservationEndpointReference implements Serializable{
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 200L;
+	
+	protected String address;
+	protected String reservationUUID;
+	protected transient W3CEndpointReference endpointReference;
+	
+	public String getAddress() {
+		return address;
+	}
+
+	public String getReservationUUID() {
+		return reservationUUID;
+	}
+
+	public W3CEndpointReference getEndpointReference() {
+		return this.getEndpointReference(null);
+	}
+	
+	public W3CEndpointReference getEndpointReference(String serviceAddress){
+		address  = address == null ? serviceAddress : address;
+
+		if (endpointReference == null) {
+			
+			StringBuffer sb = new StringBuffer(200);
+			
+			sb.append("<wsa5:EndpointReference xmlns:wsa5='http://www.w3.org/2005/08/addressing'>");
+			sb.append("<wsa5:Address>");
+			sb.append(address);
+			sb.append("</wsa5:Address>");
+			sb.append("<wsa5:ReferenceParameters>");
+			sb.append("<ns:ReservationId xmlns:ns='http://schemas.qoscosgrid.org/comp/2011/04/ares'>");
+			sb.append(reservationUUID);
+			sb.append("</ns:ReservationId>");
+			sb.append("</wsa5:ReferenceParameters>");
+			sb.append("</wsa5:EndpointReference>");
+			
+			endpointReference = EndpointReferenceUtils.loadFromString(sb.toString());
+
+		}
+			
+		return endpointReference;
+	}
+	
+	public ReservationEndpointReference(InputStream is) throws IOException {
+		this.endpointReference = EndpointReferenceUtils.loadFromStream(is);
+		
+		address = EndpointReferenceUtils.getElementValue(endpointReference, "Address");
+		reservationUUID = EndpointReferenceUtils.getElementValue(endpointReference, "ReservationId");
+		
+		if (address == null || reservationUUID == null)
+			throw new NullPointerException("Either Address or ReservationId is missing in given EPR");
+		
+	}
+	
+	public ReservationEndpointReference(W3CEndpointReference epr) {
+		this.endpointReference = epr;
+		
+		address = EndpointReferenceUtils.getElementValue(epr, "Address");
+		reservationUUID = EndpointReferenceUtils.getElementValue(epr, "ReservationId");
+		
+		if (address == null || reservationUUID == null)
+			throw new NullPointerException("Either Address or ReservationId is missing in given EPR");
+		
+	}
+	
+	public ReservationEndpointReference(String address, String reservationId) {
+		this.address = address;
+		this.reservationUUID = reservationId;
+	}
+	
+	public ReservationEndpointReference(String reservationId) {
+		this(null, reservationId);
+	}
+	
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((reservationUUID == null) ? 0 : reservationUUID.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ReservationEndpointReference other = (ReservationEndpointReference) obj;
+		if (reservationUUID == null) {
+			if (other.reservationUUID != null)
+				return false;
+		} else if (!reservationUUID.equals(other.reservationUUID))
+			return false;
+		return true;
+	}
+
+	@Override
+	public String toString() {
+		return "ActivityEndpointReference[address=" + address + ",activityUUID=" + reservationUUID + "]";
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ActivityDocument.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ActivityDocument.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ActivityDocument.java	(revision 1)
@@ -0,0 +1,32 @@
+package com.qcg.comp.sdk.types;
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+
+public class ActivityDocument {
+	protected JSDL jsdl;
+	protected String localActivityId;
+	
+	
+	public ActivityDocument(JSDL jsdl, String localActivityId) {
+		this.jsdl = jsdl;
+		this.localActivityId = localActivityId;
+	}
+	
+	public JSDL getJsdl() {
+		return jsdl;
+	}
+	public void setJsdl(JSDL jsdl) {
+		this.jsdl = jsdl;
+	}
+	public String getLocalActivityId() {
+		return localActivityId;
+	}
+	public void setLocalActivityId(String localActivityId) {
+		this.localActivityId = localActivityId;
+	}
+	
+	public String toString() {
+		return "ReservationsDocuments[jsdl=" + jsdl + ",localActivityId=" + localActivityId + "]";
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/FileInfo.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/FileInfo.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/FileInfo.java	(revision 1)
@@ -0,0 +1,71 @@
+package com.qcg.comp.sdk.types;
+
+import java.util.Date;
+
+public class FileInfo {
+
+     public static final int S_IFIFO  = 0010000;  /* named pipe (fifo) */
+     public static final int S_IFCHR  = 0020000;  /* character special */
+     public static final int S_IFDIR  = 0040000;  /* directory */
+     public static final int S_IFBLK  = 0060000;  /* block special */
+     public static final int S_IFREG  = 0100000;  /* regular */
+     public static final int S_IFLNK  = 0120000;  /* symbolic link */
+     public static final int S_IFSOCK = 0140000;  /* socket */
+     public static final int S_IFWHT  = 0160000;  /* whiteout */
+     public static final int S_ISUID  = 0004000;  /* set user id on execution */
+     public static final int S_ISGID  = 0002000;  /* set group id on execution */
+     public static final int S_ISVTX  = 0001000;  /* save swapped text even after use */
+     public static final int S_IRUSR  = 0000400;  /* read permission, owner */
+     public static final int S_IWUSR  = 0000200;  /* write permission, owner */
+     public static final int S_IXUSR  = 0000100;  /* execute/search permission, owner */
+
+
+    private Date accessTime, creationTime, modificationTime;
+    private String owner, group;
+    private int mode, nlink;
+    private long size;
+
+    public FileInfo(int mode, int nlink, String uid, String gid, long size,
+	    Date aTime, Date cTime, Date mTime) {
+	this.mode = mode;
+	this.nlink = nlink;
+	this.size = size;
+	this.owner = uid;
+	this.group = gid;
+	this.accessTime = aTime;
+	this.creationTime = cTime;
+	this.modificationTime = mTime;
+    }
+
+    public Date getAccessTime() {
+	return accessTime;
+    }
+
+    public Date getCreationTime() {
+	return creationTime;
+    }
+
+    public Date getModificationTime() {
+	return modificationTime;
+    }
+
+    public String getOwner() {
+	return owner;
+    }
+
+    public String getGroup() {
+	return group;
+    }
+
+    public int getMode() {
+	return mode;
+    }
+
+    public int getNlink() {
+	return nlink;
+    }
+
+    public long getSize() {
+	return size;
+    }
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/QCGActivityStatus.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/QCGActivityStatus.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/QCGActivityStatus.java	(revision 1)
@@ -0,0 +1,115 @@
+package com.qcg.comp.sdk.types;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import com.qcg.comp.stubs.bes.factory.ActivityStatusType;
+import com.qcg.comp.stubs.factory.ActivityEndStatusType;
+
+
+
+
+public class QCGActivityStatus {
+	
+
+	protected static final String BES_ACTIVITY_STATE_PENDING           = "Pending";
+	protected static final String BES_ACTIVITY_STATE_RUNNING           = "Running";
+	protected static final String BES_ACTIVITY_STATE_CANCELLED         = "Cancelled";
+	protected static final String BES_ACTIVITY_STATE_FAILED            = "Failed";
+	protected static final String BES_ACTIVITY_STATE_FINISHED          = "Finished";
+
+	protected static final String BES_ACTIVITY_QCG_SUBSTATE_STAGE_IN  = "Stage-in";
+	protected static final String BES_ACTIVITY_QCG_SUBSTATE_HELD      = "Held";
+	protected static final String BES_ACTIVITY_QCG_SUBSTATE_QUEUED    = "Queued";
+	protected static final String BES_ACTIVITY_QCG_SUBSTATE_EXECUTING = "Executing";
+	protected static final String BES_ACTIVITY_QCG_SUBSTATE_SUSPENDED = "Suspended";
+	protected static final String BES_ACTIVITY_QCG_SUBSTATE_STAGE_OUT = "Stage-out";
+	
+	public static final String QCG_ACTIVITY_STATE_CANCELLED         = BES_ACTIVITY_STATE_CANCELLED;
+	public static final String QCG_ACTIVITY_STATE_FAILED            = BES_ACTIVITY_STATE_FAILED;
+	public static final String QCG_ACTIVITY_STATE_FINISHED          = BES_ACTIVITY_STATE_FINISHED;
+	public static final String QCG_ACTIVITY_STATE_STAGE_IN          = BES_ACTIVITY_QCG_SUBSTATE_STAGE_IN;
+	public static final String QCG_ACTIVITY_STATE_HELD              = BES_ACTIVITY_QCG_SUBSTATE_HELD;
+	public static final String QCG_ACTIVITY_STATE_QUEUED            = BES_ACTIVITY_QCG_SUBSTATE_QUEUED;
+	public static final String QCG_ACTIVITY_STATE_EXECUTING         = BES_ACTIVITY_QCG_SUBSTATE_EXECUTING;
+	public static final String QCG_ACTIVITY_STATE_SUSPENDED         = BES_ACTIVITY_QCG_SUBSTATE_SUSPENDED;
+	public static final String QCG_ACTIVITY_STATE_STAGE_OUT         = BES_ACTIVITY_QCG_SUBSTATE_STAGE_OUT;
+	
+	protected String stateName;
+	protected String subStateName;
+	protected ActivityEndStatusType endStatus;
+	protected W3CEndpointReference activityIdentifier;
+	protected ActivityStatusType raw;
+	
+	public QCGActivityStatus(W3CEndpointReference activityIdentifier, ActivityStatusType status) {
+		super();
+		this.activityIdentifier = activityIdentifier;
+		this.endStatus = status.getActivityEndStatus();
+		this.stateName = status.getState().value();
+		this.raw = status;
+		
+		if (status.getStageIn() != null) 
+			subStateName = QCGActivityStatus.BES_ACTIVITY_QCG_SUBSTATE_STAGE_IN;
+		else if (status.getStageOut() != null) 
+			subStateName = QCGActivityStatus.BES_ACTIVITY_QCG_SUBSTATE_STAGE_OUT;
+		else if (status.getHeld() != null) 
+			subStateName = QCGActivityStatus.BES_ACTIVITY_QCG_SUBSTATE_HELD;
+		else if (status.getQueued() != null) 
+			subStateName = QCGActivityStatus.BES_ACTIVITY_QCG_SUBSTATE_QUEUED;
+		else if (status.getExecuting() != null) 
+			subStateName = QCGActivityStatus.BES_ACTIVITY_QCG_SUBSTATE_EXECUTING;
+		else if (status.getSuspended() != null) 
+			subStateName = QCGActivityStatus.BES_ACTIVITY_QCG_SUBSTATE_SUSPENDED;
+		else 
+			subStateName = null;
+	}
+	
+	public QCGActivityStatus(W3CEndpointReference activityIdentifier, ActivityEndStatusType endStatus, String stateName,
+			String subStateName) {
+		super();
+		this.activityIdentifier = activityIdentifier;
+		this.endStatus = endStatus;
+		this.stateName = stateName;
+		this.subStateName = subStateName;
+	}
+	
+	public String getBESStateName(){
+		return stateName;
+	}
+	
+	public String getBESSubStateName() {
+		return subStateName;
+	}
+
+	public ActivityEndStatusType getEndStatus() {
+		return endStatus;
+	}
+	
+	public String getState() {
+		if (subStateName != null) {
+			return subStateName;
+		} else {
+			return stateName;
+		}
+	}
+
+	public W3CEndpointReference getActivityIdentifier() {
+		return activityIdentifier;
+	}
+	
+	public String toString() {
+		return "Status[state=" + getState() + (endStatus != null ? ",exitcode=" + endStatus.getExitStatus() : "" ) + (getFaultString()!=null ? getFaultString() : "" ) + "]";
+	}
+	
+	public boolean isFinalState() {
+		return (BES_ACTIVITY_STATE_FINISHED.equals(stateName) || BES_ACTIVITY_STATE_FAILED.equals(stateName) || BES_ACTIVITY_STATE_CANCELLED.equals(stateName));
+	}
+	
+	public ActivityStatusType getRAW(){
+		return raw;
+	}
+	
+	public String getFaultString() {
+		return (raw.getFault() != null ? raw.getFault().getFaultstring() : null);
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ActivityEndpointReference.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ActivityEndpointReference.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ActivityEndpointReference.java	(revision 1)
@@ -0,0 +1,101 @@
+package com.qcg.comp.sdk.types;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import com.qcg.core.sdk.utils.EndpointReferenceUtils;
+
+public class ActivityEndpointReference {
+	protected String address;
+	protected String activityUUID;
+	protected transient W3CEndpointReference endpointReference;
+	
+	public String getAddress() {
+		return address;
+	}
+
+	public String getActivityUUID() {
+		return activityUUID;
+	}
+
+	public W3CEndpointReference getEndpointReference() {
+		return this.getEndpointReference(null);
+	}
+	
+	public W3CEndpointReference getEndpointReference(String serviceAddress){
+		address  = address == null ? serviceAddress : address;
+		
+		if (endpointReference == null) {
+			
+			StringBuffer sb = new StringBuffer(200);
+			
+			sb.append("<wsa5:EndpointReference xmlns:wsa5='http://www.w3.org/2005/08/addressing'>");
+			sb.append("<wsa5:Address>");
+			sb.append(address);
+			sb.append("</wsa5:Address>");
+			sb.append("<wsa5:ReferenceParameters>");
+			sb.append("<ns:ActivityId xmlns:ns='http://schemas.qoscosgrid.org/comp/2011/04/factory'>");
+			sb.append(activityUUID);
+			sb.append("</ns:ActivityId>");
+			sb.append("</wsa5:ReferenceParameters>");
+			sb.append("</wsa5:EndpointReference>");
+			
+			endpointReference = EndpointReferenceUtils.loadFromString(sb.toString());
+
+		}
+			
+		return endpointReference;
+	}
+
+	
+	public ActivityEndpointReference(W3CEndpointReference epr) {
+		this.endpointReference = epr;
+		
+		address = EndpointReferenceUtils.getElementValue(epr, "Address");
+		activityUUID = EndpointReferenceUtils.getElementValue(epr, "ActivityId");
+		
+		if (address == null || activityUUID == null)
+			throw new NullPointerException("Either Address or ActivityId is missing in given EPR");
+		
+	}
+	
+	public ActivityEndpointReference(String address, String activityUUID) {
+		this.address = address;
+		this.activityUUID = activityUUID;
+	}
+	
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((activityUUID == null) ? 0 : activityUUID.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ActivityEndpointReference other = (ActivityEndpointReference) obj;
+		if (activityUUID == null) {
+			if (other.activityUUID != null)
+				return false;
+		} else if (!activityUUID.equals(other.activityUUID))
+			return false;
+		return true;
+	}
+
+	public	ActivityEndpointReference(String reservationId) {
+		this(null, reservationId);
+	}
+	
+	@Override
+	public String toString() {
+		return "ActivityEndpointReference[address=" + address + ",activityUUID=" + activityUUID + "]";
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ReservationDocument.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ReservationDocument.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/types/ReservationDocument.java	(revision 1)
@@ -0,0 +1,30 @@
+package com.qcg.comp.sdk.types;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+
+public class ReservationDocument {
+	protected ARDL ardl;
+	protected String localReservationId;
+	
+	public ReservationDocument(ARDL ardl, String localReservationId) {
+		this.ardl = ardl;
+		this.localReservationId = localReservationId;
+	}
+	
+	public ARDL getArdl() {
+		return ardl;
+	}
+	public void setArdl(ARDL ardl) {
+		this.ardl = ardl;
+	}
+	public String getLocalReservationId() {
+		return localReservationId;
+	}
+	public void setLocalReservationId(String localReservationId) {
+		this.localReservationId = localReservationId;
+	}
+	
+	public String toString() {
+		return "ReservationsDocument[ardl=" + ardl + ",localReservationId=" + localReservationId + "]";
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGManagement.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGManagement.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGManagement.java	(revision 1)
@@ -0,0 +1,86 @@
+package com.qcg.comp.sdk;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.handler.Handler;
+
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.stubs.bes.management.BESManagement;
+import com.qcg.comp.stubs.bes.management.BESManagementPortType;
+import com.qcg.comp.stubs.bes.management.NotAuthorizedFault;
+import com.qcg.comp.stubs.bes.management.StartAcceptingNewActivitiesType;
+import com.qcg.comp.stubs.bes.management.StopAcceptingNewActivitiesType;
+import com.qcg.core.sdk.QCGCoreService;
+import com.qcg.core.sdk.security.AuthenticationModule;
+
+public class QCGManagement extends QCGCoreService{
+
+	public QCGManagement(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer, boolean useWSA)
+			throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer, useWSA);
+	}
+
+	public QCGManagement(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer);
+	}
+
+	public QCGManagement(String hostname, int port, AuthenticationModule am)
+			throws JAXBException {
+		super(hostname, port, am);
+	}
+
+	protected BESManagementPortType BESmanagement;
+	public static final String BES_MANAGEMENT_NS = "http://schemas.ggf.org/bes/2006/08/bes-management";
+
+	public QCGManagement(String hostname, int port, AuthenticationModule am,
+			boolean useWSA) throws JAXBException{
+		super(hostname, port, am, useWSA);
+		
+		BESmanagement = (BESManagementPortType)stubs;
+	}
+	
+	@Override
+	protected Service getService(){
+
+		return new BESManagement(QCGManagement.class.getResource("/schemas/bes-management.wsdl"), new QName(BES_MANAGEMENT_NS, "BESManagement"));
+	}
+	
+	@Override
+	@SuppressWarnings("all")
+	protected List<Handler> getHandlersChain() {
+		return null;
+	}
+
+	@Override
+	protected Object getPort(Service service, WebServiceFeature... features) {
+		return ((BESManagement)service).getBESManagement(features);
+	}
+	
+	
+	public void startAcceptingNewActivites() throws NotAuthorizedException {
+		StartAcceptingNewActivitiesType parameters = new StartAcceptingNewActivitiesType();
+		try {
+			BESmanagement.startAcceptingNewActivities(parameters);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		}
+	
+	}
+	
+	public void stopAcceptingNewActivites() throws NotAuthorizedException {
+		StopAcceptingNewActivitiesType parameters = new StopAcceptingNewActivitiesType();
+		try {
+			BESmanagement.stopAcceptingNewActivities(parameters);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		}
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGStaging.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGStaging.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGStaging.java	(revision 1)
@@ -0,0 +1,297 @@
+package com.qcg.comp.sdk;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.soap.SOAPBinding;
+
+import com.qcg.comp.sdk.exceptions.DeleteOnTerminationException;
+import com.qcg.comp.sdk.exceptions.FileNotFoundException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.StagingException;
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.types.FileInfo;
+import com.qcg.comp.stubs.jsdl.DataStagingType;
+import com.qcg.comp.stubs.jsdl.JobDefinitionType;
+import com.qcg.comp.stubs.staging.ChModType;
+import com.qcg.comp.stubs.staging.DeleteOnTerminationFault;
+import com.qcg.comp.stubs.staging.FileNotFoundFault;
+import com.qcg.comp.stubs.staging.MkDirType;
+import com.qcg.comp.stubs.staging.NotAuthorizedFault;
+import com.qcg.comp.stubs.staging.QCGComputingStaging;
+import com.qcg.comp.stubs.staging.QCGComputingStagingPortType;
+import com.qcg.comp.stubs.staging.StageFilesInType;
+import com.qcg.comp.stubs.staging.StageFilesOutType;
+import com.qcg.comp.stubs.staging.StagingFault;
+import com.qcg.core.sdk.QCGCoreService;
+import com.qcg.core.sdk.attachments.AttachmentHandler;
+import com.qcg.core.sdk.attachments.FileStagingHandler;
+import com.qcg.core.sdk.security.AuthenticationModule;
+import com.sun.xml.internal.ws.developer.JAXWSProperties;
+import com.sun.xml.ws.developer.StreamingAttachmentFeature;
+
+public class QCGStaging extends QCGCoreService {
+
+	public static final String QCG_STAGING_NS = "http://schemas.qoscosgrid.org/comp/2011/04/staging";
+
+	protected QCGComputingStagingPortType staging;
+	protected FileStagingHandlerWrapper stagingHandler;
+	protected volatile IOException stagingException;
+	protected AttachmentHandler attachmentHandler;
+
+	protected class FileStagingHandlerWrapper implements FileStagingHandler {
+		protected FileStagingHandler userFileHandler;
+		protected Map<String, String> uuidMap = new HashMap<String, String>();
+		
+		public FileStagingHandlerWrapper(FileStagingHandler userFileHandler) {
+			this.userFileHandler = userFileHandler;
+		}
+
+		public InputStream stageIn(String sourceFileName) throws IOException {
+
+			return userFileHandler.stageIn(sourceFileName);
+		}
+
+		public void stageOut(String targetFileName, InputStream fileStream)
+				throws IOException {
+			synchronized (uuidMap) {
+				userFileHandler.stageOut(uuidMap.remove(targetFileName), fileStream);
+			}
+		}
+		
+		public void addAssociation(String uuid, String targetFileName) {
+			synchronized (uuidMap) {
+				uuidMap.put(uuid, targetFileName);
+			}
+		}
+
+	}
+
+	protected class BinaryDataSource implements DataSource {
+
+		protected String name;
+		protected InputStream inputStream;
+
+		public BinaryDataSource(String name, InputStream inputStream) {
+			super();
+			this.name = name;
+			this.inputStream = inputStream;
+		}
+
+		public String getContentType() {
+			return "application/octet-stream";
+		}
+
+		public InputStream getInputStream() throws IOException {
+			return inputStream;
+		}
+
+		public String getName() {
+			return name;
+		}
+
+		public OutputStream getOutputStream() throws IOException {
+			return null;
+		}
+
+	}
+
+	public QCGStaging(String hostname, int port, AuthenticationModule tm, AuthenticationModule mm,
+			boolean useWSA, FileStagingHandler userStagingHandler)
+			throws JAXBException {
+		super(hostname, port, tm, mm, useWSA);
+
+		this.stagingHandler = new FileStagingHandlerWrapper(userStagingHandler);
+		this.staging = (QCGComputingStagingPortType) stubs;
+	}
+
+	
+	@Override
+	@SuppressWarnings("all")
+	protected List<Handler> getHandlersChain() {
+		attachmentHandler = new AttachmentHandler(
+				new AttachmentHandler.IOExceptionListener() {
+
+					public void exceptionThrown(IOException ex) {
+						stagingException = ex;
+					}
+				});
+
+		List<Handler> handlers = new ArrayList<Handler>();
+		handlers.add(attachmentHandler);
+
+		return handlers;
+	}
+
+	@Override
+	protected Object getPort(Service service, WebServiceFeature... features) {
+		return ((QCGComputingStaging) service).getQCGComputingStaging(features);
+	}
+
+	@Override
+	protected Service getService() {
+		return new QCGComputingStaging(QCGStaging.class
+				.getResource("/schemas/qcg-comp-staging.wsdl"), new QName(
+				QCG_STAGING_NS, "QCGComputingStaging"));
+	}
+	
+   protected void checkForIOException() throws IOException{
+   	 if (stagingException != null) {
+   		 IOException ioEx = stagingException;
+   		 stagingException = null;
+   		 throw ioEx;
+   	 }
+   }
+
+	public synchronized void stageInFiles(JSDL jsdl) throws IOException, FileNotFoundException, NotAuthorizedException, StagingException {
+		JobDefinitionType jobDefinition = jsdl.toJobDefinition();
+
+		Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
+
+		for (DataStagingType ds : jobDefinition.getJobDescription().getDataStaging()) {
+			if (ds.getSource() == null || ds.getSource().getURI() == null) {
+				continue;
+			}
+			String sourceURI = ds.getSource().getURI();
+			String sourceUUID = "cid:" + UUID.randomUUID().toString();
+			ds.getSource().setURI(sourceUUID);
+
+			attachments.put(sourceUUID, new DataHandler(new BinaryDataSource(sourceUUID, stagingHandler.stageIn(sourceURI))));
+		}
+
+		((BindingProvider) staging).getRequestContext().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, attachments);
+
+		StageFilesInType parameters = new StageFilesInType();
+		parameters.setJobDefinition(jobDefinition);
+		try {
+			staging.stageFilesIn(parameters);
+			checkForIOException() ;
+		} catch (FileNotFoundFault e) {
+			throw new FileNotFoundException(e);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (StagingFault e) {
+			throw new StagingException(e);
+		} finally {
+			((BindingProvider) staging).getRequestContext().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, null);
+		}
+	}
+
+	public synchronized void stageOutFiles(JSDL jsdl) throws IOException, DeleteOnTerminationException, FileNotFoundException, NotAuthorizedException, StagingException {
+		JobDefinitionType jobDefinition = jsdl.toJobDefinition();
+		
+		for (DataStagingType ds : jobDefinition.getJobDescription().getDataStaging()) {
+			if (ds.getTarget() == null || ds.getTarget().getURI() == null) {
+				continue;
+			}
+			String targetURI = ds.getTarget().getURI();
+			String targetUUID = "cid:" + UUID.randomUUID().toString();
+			ds.getTarget().setURI(targetUUID);
+			stagingHandler.addAssociation(targetUUID, targetURI);
+		}
+
+		StageFilesOutType parameters = new StageFilesOutType();
+		parameters.setJobDefinition(jobDefinition);
+
+		this.attachmentHandler.setFileStagingHandler(this.stagingHandler);
+
+		try {
+			((BindingProvider)staging).getRequestContext().put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 1024);
+
+			staging.stageFilesOut(parameters);
+		} catch (DeleteOnTerminationFault e) {
+			throw new DeleteOnTerminationException(e);
+		} catch (FileNotFoundFault e) {
+			throw new FileNotFoundException(e);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (StagingFault e) {
+			throw new StagingException(e);
+		}
+		checkForIOException(); 
+	}
+
+	public synchronized JSDL listDirectory(String directory, String userName) throws FileNotFoundFault, NotAuthorizedFault {	    
+	    return new JSDL(this.staging.listDirectory(directory, userName));
+	}	
+	
+	public synchronized FileInfo[] statFile(List<String> paths, String userName) throws FileNotFoundFault, NotAuthorizedFault, StagingFault {
+		List<com.qcg.comp.stubs.staging.FileInfo> s = this.staging.statFile(paths, userName);
+		FileInfo[] result = new FileInfo[s.size()];
+		for (int i = 0; i < s.size(); i++) {
+			com.qcg.comp.stubs.staging.FileInfo l = s.get(i);
+
+			result[i] = new FileInfo(l.getMode(), l.getNLink(), l.getUID(),
+					l.getGID(), l.getSize(), l.getATime().toGregorianCalendar()
+					.getTime(), l.getCTime().toGregorianCalendar()
+					.getTime(), l.getMTime().toGregorianCalendar()
+					.getTime());
+		}
+		return result;    
+	}
+
+	public QCGStaging(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer, FileStagingHandler userStagingHandler) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer);
+		
+		this.stagingHandler = new FileStagingHandlerWrapper(userStagingHandler);
+		this.staging = (QCGComputingStagingPortType) stubs;
+	}
+
+	public QCGStaging(String hostname, int port, AuthenticationModule am, boolean useWSA,  FileStagingHandler userStagingHandler) throws JAXBException {
+		super(hostname, port, am, useWSA);
+		
+		this.stagingHandler = new FileStagingHandlerWrapper(userStagingHandler);
+		this.staging = (QCGComputingStagingPortType) stubs;
+	}
+
+	public QCGStaging(String hostname, int port, AuthenticationModule am,  FileStagingHandler userStagingHandler)
+			throws JAXBException {
+		super(hostname, port, am);
+		
+		this.stagingHandler = new FileStagingHandlerWrapper(userStagingHandler);
+		this.staging = (QCGComputingStagingPortType) stubs;
+	}
+
+	public synchronized void delete(String file, String userName) throws FileNotFoundFault, NotAuthorizedFault, StagingFault {
+	    this.staging.delete(file, userName);
+	    
+	}
+
+    public synchronized void chmod(String file, String mode, String userName) throws FileNotFoundFault, NotAuthorizedFault, StagingFault {
+	ChModType parameters = new ChModType();
+
+	parameters.setPath(file);
+	parameters.setMode(mode);
+	parameters.setUserName(userName);
+
+	this.staging.chMod(parameters);
+    }
+
+    public synchronized void mkdir(String dir, String mode, String userName) throws FileNotFoundFault, NotAuthorizedFault, StagingFault {
+	MkDirType parameters = new MkDirType();
+
+	parameters.setPath(dir);
+	parameters.setMode(mode);
+	parameters.setUserName(userName);
+
+	this.staging.mkDir(parameters);
+    }
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGRsync.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGRsync.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGRsync.java	(revision 1)
@@ -0,0 +1,629 @@
+package com.qcg.comp.sdk;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.Security;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.xml.bind.JAXBException;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeConstants;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+import org.metastatic.rsync.Checksum32;
+import org.metastatic.rsync.ChecksumPair;
+import org.metastatic.rsync.Configuration;
+import org.metastatic.rsync.GeneratorEvent;
+import org.metastatic.rsync.GeneratorListener;
+import org.metastatic.rsync.GeneratorStream;
+import org.metastatic.rsync.JarsyncProvider;
+import org.metastatic.rsync.ListenerException;
+import org.metastatic.rsync.Rdiff;
+
+import com.qcg.comp.sdk.jsdl.JSDL;
+import com.qcg.comp.sdk.rsync.DeltaDataSource;
+import com.qcg.comp.sdk.rsync.DeltaInputStream;
+import com.qcg.comp.sdk.rsync.GetDeltaHandler;
+import com.qcg.comp.sdk.rsync.Params;
+import com.qcg.comp.stubs.rsync.BlockSignatureType;
+import com.qcg.comp.stubs.rsync.CommonType;
+import com.qcg.comp.stubs.rsync.FileType;
+import com.qcg.comp.stubs.rsync.FilesType;
+import com.qcg.comp.stubs.rsync.IOFault;
+import com.qcg.comp.stubs.rsync.InternalFault;
+import com.qcg.comp.stubs.rsync.InvalidPathFault;
+import com.qcg.comp.stubs.rsync.RsyncFault;
+import com.qcg.comp.stubs.rsync.QCGComputingRsync;
+import com.qcg.comp.stubs.rsync.QCGComputingRsyncPortType;
+import com.qcg.comp.stubs.rsync.SignatureType;
+import com.qcg.comp.stubs.staging.FileNotFoundFault;
+import com.qcg.comp.stubs.staging.NotAuthorizedFault;
+import com.qcg.comp.stubs.staging.StagingFault;
+import com.qcg.core.sdk.QCGCoreService;
+import com.qcg.core.sdk.attachments.AttachmentHandler;
+import com.qcg.core.sdk.security.AuthenticationModule;
+
+public class QCGRsync extends QCGCoreService {
+
+	public static final String QCG_RSYNC_NS = "http://schemas.qoscosgrid.org/comp/2011/04/rsync";
+
+	protected static final sun.misc.BASE64Encoder BASE64_ENCODER = new sun.misc.BASE64Encoder();
+	protected static final sun.misc.BASE64Decoder BASE64_DECODER = new sun.misc.BASE64Decoder();
+
+	protected QCGComputingRsyncPortType rsync;
+	protected QCGStaging staging;
+
+	protected AttachmentHandler attachmentHandler;
+
+	protected Rdiff rdiff = new Rdiff();
+	protected static DatatypeFactory dtFactory = null; 
+
+	
+	static {
+		Security.addProvider(new JarsyncProvider());
+		try {
+			dtFactory = DatatypeFactory.newInstance();
+		} catch (DatatypeConfigurationException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public QCGRsync(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer, boolean useWSA)
+			throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer, useWSA);
+		this.rsync = (QCGComputingRsyncPortType) stubs;
+		
+		staging = new QCGStaging(hostname, port, transportLayer, messageLayer, useWSA, null);
+
+	}
+
+	public QCGRsync(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer);
+		this.rsync = (QCGComputingRsyncPortType) stubs;
+		
+		staging = new QCGStaging(hostname, port, transportLayer, messageLayer, null);
+	}
+
+	public QCGRsync(String hostname, int port, AuthenticationModule am)
+			throws JAXBException {
+		super(hostname, port, am);
+		this.rsync = (QCGComputingRsyncPortType) stubs;
+		
+		staging = new QCGStaging(hostname, port, am, null);
+	}
+
+	public QCGRsync(String hostname, int port, AuthenticationModule am,
+			boolean useWSA) throws JAXBException {
+		super(hostname, port, am, useWSA);
+		this.rsync = (QCGComputingRsyncPortType) stubs;
+		
+		staging = new QCGStaging(hostname, port, am, null);
+	}
+	
+	private class LazyInputStream extends InputStream {
+
+		private FileInputStream file = null;
+
+		public LazyInputStream(String filename) {
+			try {
+				file = new FileInputStream(filename);
+			} catch (FileNotFoundException e) {
+			}
+		}
+
+		@Override
+		public int read() throws IOException {
+			return file != null ? file.read() : -1;
+		}
+
+		@Override
+		public int read(byte[] b) throws IOException {
+			return file != null ? file.read(b) : -1;
+		}
+
+		@Override
+		public int read(byte[] b, int off, int len) throws IOException {
+			return file != null ? file.read(b, off, len) : -1;
+		}
+
+
+		@Override
+		public void close() throws IOException {
+			if (file != null) 
+				file.close();
+		}
+
+	}
+
+
+	@Override
+	protected Object getPort(Service service, WebServiceFeature... features) {
+		return ((QCGComputingRsync) service).getQCGComputingRsync(features);
+	}
+
+	@Override
+	protected Service getService() {
+		return new QCGComputingRsync(
+				QCGRsync.class.getResource("/schemas/qcg-comp-rsync.wsdl"),
+				new QName(QCG_RSYNC_NS, "QCGComputingRsync"));
+	}
+
+	private IOException stagingException;
+
+	@Override
+	@SuppressWarnings("all")
+	protected List<Handler> getHandlersChain() {
+		attachmentHandler = new AttachmentHandler(
+				new AttachmentHandler.IOExceptionListener() {
+
+					public void exceptionThrown(IOException ex) {
+						stagingException = ex;
+					}
+				});
+
+		List<Handler> handlers = new ArrayList<Handler>();
+		handlers.add(attachmentHandler);
+
+		return handlers;
+	}
+
+	protected void checkForIOException() throws IOException {
+		if (stagingException != null) {
+			IOException ioEx = stagingException;
+			stagingException = null;
+			throw ioEx;
+		}
+	}
+
+	protected String joinPath(String dir, String file) {
+		// The File.pathSeparator is not used to ensure compatibility with
+		// qcg-comp-rsync, which has / hardcoded
+		if (!dir.endsWith("/"))
+			dir += "/";
+		return dir + file;
+	}
+
+	private FilesType getLocalFiles(String basedir, String path) 
+			throws DatatypeConfigurationException, IOException {
+		FilesType localFiles = new FilesType();
+		File dir = new File(joinPath(basedir, path));
+		
+		for (String s : dir.list()) {
+			s = joinPath(path, s);
+			File f = new File(joinPath(basedir, s));
+			
+			if (f.isFile() && !f.canRead()) {
+				throw new IOException("Unable to read file: " + f.getAbsolutePath());
+			}
+			
+			if (f.isDirectory()) {
+				List<FileType> subFiles = getLocalFiles(basedir, s).getFile();
+				
+				if (subFiles.size() == 0) {
+					FileType emptyDir = new FileType();
+				
+					emptyDir.setPath(s);
+					emptyDir.setMTime(timestampToXML(f.lastModified()));
+					emptyDir.setIsDirectory(true);
+					emptyDir.setIsExecutable(false);
+					
+					localFiles.getFile().add(emptyDir);
+				}
+				
+				localFiles.getFile().addAll(subFiles);
+			}  else {
+				FileType file = new FileType();
+				
+				file.setPath(s);
+				file.setMTime(timestampToXML(f.lastModified()));
+				file.setIsDirectory(false);
+				file.setIsExecutable(f.canExecute());
+				
+				localFiles.getFile().add(file);
+			}
+		
+		}
+		
+		return localFiles;
+	}
+
+	private XMLGregorianCalendar timestampToXML(long time)
+			throws DatatypeConfigurationException {
+
+		GregorianCalendar cal = new GregorianCalendar();
+		cal.setTime(new Date(time));
+		XMLGregorianCalendar xml = dtFactory.newXMLGregorianCalendar(cal);
+		
+		return xml;
+	}
+
+	private class SignatureGeneratorListener implements GeneratorListener {
+
+		private SignatureType result;
+
+		public SignatureGeneratorListener(SignatureType result) {
+			this.result = result;
+		}
+
+		public void update(GeneratorEvent event) throws ListenerException {
+			ChecksumPair pair = event.getChecksumPair();
+			BlockSignatureType blockSig = new BlockSignatureType();
+			
+			blockSig.setWeak(pair.getWeak());
+			blockSig.setStrong(BASE64_ENCODER.encode(pair.getStrong()));
+			
+			result.getSignatures().add(blockSig);
+		}
+
+	}
+
+	private SignatureType GetSignature(String fullpath) throws IOException,
+			NoSuchAlgorithmException {
+		Configuration c = new Configuration();
+		
+		c.strongSum = MessageDigest.getInstance("MD4");
+		c.weakSum = new Checksum32(Params.CHAR_OFFSET);
+		c.blockLength = Params.BLOCK_LENGTH;
+		c.strongSumLength = Params.STRONG_SUM_LENGTH;
+		
+		SignatureType result = new SignatureType();
+		result.setBlockLength(c.blockLength);
+		
+		File f = new File(fullpath);
+		
+		result.setLength((int) f.length());
+		result.setRemainder((int) f.length() % c.blockLength);
+		result.setStrongSumLength(c.strongSumLength);
+		
+		GeneratorStream gen = new GeneratorStream(c);
+		gen.addListener(new SignatureGeneratorListener(result));
+		
+		int len = 0;
+		byte[] buf = new byte[Params.CHUNK_SIZE];
+
+		InputStream in = new LazyInputStream(fullpath);
+		
+		while ((len = in.read(buf)) != -1) {
+			try {
+				gen.update(buf, 0, len);
+			} catch (ListenerException le) {
+				throw (IOException) le.getCause();
+			}
+		}
+		
+		try {
+			gen.doFinal();
+		} catch (ListenerException le) {
+			throw (IOException) le.getCause();
+		}
+		
+		return result;
+	}
+
+	private void putDelta(CommonType common, String localBasedir, String path)
+			throws IOFault, InternalFault, RsyncFault, IOException,
+			NoSuchAlgorithmException {
+		
+		System.out.println("Sending file: " + path);
+		
+		List<ChecksumPair> signatures = getSignatures(common, path);
+		
+		Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
+		DataSource delta = new DeltaDataSource(new DeltaInputStream(signatures, new LazyInputStream(joinPath(localBasedir, path))));
+		
+		attachments.put("delta", new DataHandler(delta));
+		
+		((BindingProvider) rsync).getRequestContext().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, attachments);
+		rsync.putDelta(common, path);
+		((BindingProvider) rsync).getRequestContext().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, null);
+		
+		checkForIOException();
+	}
+
+	private List<ChecksumPair> getSignatures(CommonType common, String path)
+			throws IOFault, InternalFault, RsyncFault, IOException {
+		
+		List<ChecksumPair> signatures = new ArrayList<ChecksumPair>();
+		long offset = 0;
+		
+		SignatureType sig = rsync.getSignature(common, path);
+		
+		for (BlockSignatureType block : sig.getSignatures()) {
+			signatures.add(new ChecksumPair(block.getWeak(), BASE64_DECODER.decodeBuffer(block.getStrong()), offset));
+			offset += sig.getBlockLength();
+		}
+		
+		return signatures;
+	}
+
+	private void getDelta(CommonType common, String localBasedir, String path)
+			throws NoSuchAlgorithmException, IOException {
+		
+		System.out.println("Receiving file: " + path);
+		
+		String fullpath = new File(joinPath(localBasedir, path)).getAbsolutePath();
+		SignatureType sig = GetSignature(fullpath);
+		
+		attachmentHandler.setFileStagingHandler(new GetDeltaHandler(fullpath));
+		rsync.getDelta(common, path, sig);
+		attachmentHandler.setFileStagingHandler(null);
+		
+		checkForIOException();		
+	}
+
+	private boolean fileOk(String path, List<Pattern> exclude) {
+
+		if (exclude != null) {
+
+
+			String pathTokens[] = path.split("/");
+			
+			for (int i=0; i < pathTokens.length; i++)
+				for (Pattern p : exclude) {
+	
+					if (p.matcher(pathTokens[i]).matches()) {
+						System.out.println("Ignoring file " + path + " because of " + p);
+						return false;
+					}
+	
+				}
+		}
+
+		return true;
+	}
+
+	/**
+	 * two-way r-synchronize 
+	 **/
+	public void synchronize(JSDL jsdl, String localDirectory, List<Pattern> exclude) 
+					throws 
+					InternalFault, 
+					InvalidPathFault,
+					DatatypeConfigurationException, 
+					NoSuchAlgorithmException,
+					IOException, 
+					IOFault, 
+					RsyncFault, 
+					FileNotFoundFault, 
+					NotAuthorizedFault, 
+					StagingFault {
+		
+		CommonType params = new CommonType();
+		
+		
+		params.setBaseDir(jsdl.getWorkingDirectory());
+		params.setUserName(jsdl.getUserName());
+		
+		FilesType remoteFiles = rsync.getFiles(params);
+		FilesType localFiles = getLocalFiles(localDirectory, "");
+		
+		for (FileType local : localFiles.getFile()) {
+			boolean found = false;
+
+			if (!fileOk(local.getPath(), exclude))
+				continue;
+
+			for (FileType remote : remoteFiles.getFile()) {
+				if (local.getPath().equals(remote.getPath())) {
+					found = true;
+					if (local.getMTime().compare(remote.getMTime()) == DatatypeConstants.LESSER)
+						getDelta(params, localDirectory, local.getPath());
+					else
+						putDelta(params, localDirectory, local.getPath());
+				}
+			}
+			if (!found) {
+				if (! local.isIsDirectory()) {
+					putDelta(params, localDirectory, local.getPath());
+					
+					if (local.isIsExecutable())
+						staging.chmod(jsdl.getWorkingDirectory() + "/" + local.getPath(), "0755", jsdl.getUserName());
+					
+				} else {
+					staging.mkdir(jsdl.getWorkingDirectory() + local.getPath(), "0755", jsdl.getUserName());
+				}
+			}
+		}
+		
+		for (FileType remote : remoteFiles.getFile()) {
+			boolean found = false;
+
+			if (!fileOk(remote.getPath(), exclude))
+				continue;
+
+			for (FileType local : localFiles.getFile()) {
+				if (local.getPath().equals(remote.getPath())) {
+					found = true;
+					break;
+				}
+			}
+			
+			if (!found)
+				getDelta(params, localDirectory, remote.getPath());
+		}
+	}
+
+	protected List<Pattern> globToRegex(List<String> input) {
+		List<Pattern> result = new ArrayList<Pattern>();
+
+		for (String s : input) {
+			s = s.replace(".", "\\.");
+			s = s.replace("?", ".");
+			s = s.replace("*", ".*");
+			s = "^(.*/|)" + s + "(/.*|)$";
+			result.add(Pattern.compile(s));
+		}
+
+		return result;
+	}
+
+	/***
+	 * cmdline rsync compatible version of localToRemote
+	 * @param jsdl
+	 * @param localDirectory
+	 * @param exclude
+	 * @throws InternalFault
+	 * @throws InvalidPathFault
+	 * @throws DatatypeConfigurationException
+	 * @throws NoSuchAlgorithmException
+	 * @throws IOException
+	 * @throws IOFault
+	 * @throws RsyncFault
+	 * @throws StagingFault 
+	 * @throws NotAuthorizedFault 
+	 * @throws FileNotFoundFault 
+	 */
+	public void rsyncLocalToRemote(JSDL jsdl, String localDirectory,
+			List<String> exclude) throws InternalFault, InvalidPathFault,
+			DatatypeConfigurationException, NoSuchAlgorithmException,
+			IOException, IOFault, RsyncFault, FileNotFoundFault, NotAuthorizedFault, StagingFault {
+
+		List<Pattern> regexExclude = globToRegex(exclude);
+
+		Security.addProvider(new JarsyncProvider());
+		CommonType params = new CommonType();
+		params.setBaseDir(jsdl.getWorkingDirectory());
+		params.setUserName(jsdl.getUserName());
+		if (new File(localDirectory).isDirectory()) {
+			params.setBaseDir(jsdl.getWorkingDirectory() + "/" + localDirectory);
+			FilesType localFiles = getLocalFiles(localDirectory, "");
+			for (FileType local : localFiles.getFile()) {
+
+				if (!fileOk(local.getPath(), regexExclude))
+					continue;
+				
+				if (! local.isIsDirectory()) {
+					putDelta(params, localDirectory, local.getPath());
+				} else {
+					staging.mkdir(jsdl.getWorkingDirectory()  + "/" + localDirectory + local.getPath(), "0755", jsdl.getUserName());
+				}
+
+			}
+		} else if (fileOk(localDirectory, regexExclude))
+			putDelta(params, "./", localDirectory);
+	}
+
+	/***
+	 * one-way (update remote site) synchronize
+	 * @param jsdl
+	 * @param localDirectory
+	 * @param exclude
+	 * @throws InternalFault
+	 * @throws InvalidPathFault
+	 * @throws DatatypeConfigurationException
+	 * @throws NoSuchAlgorithmException
+	 * @throws IOException
+	 * @throws IOFault
+	 * @throws RsyncFault
+	 * @throws FileNotFoundFault
+	 * @throws NotAuthorizedFault
+	 * @throws StagingFault
+	 */
+	public void localToRemote(JSDL jsdl, String localDirectory, List<Pattern> exclude) 
+					throws 
+					InternalFault, 
+					InvalidPathFault,
+					DatatypeConfigurationException, 
+					NoSuchAlgorithmException,
+					IOException, 
+					IOFault, 
+					RsyncFault, 
+					FileNotFoundFault, 
+					NotAuthorizedFault, 
+					StagingFault {
+		Set<String> createdDirectories = new HashSet<String>(); 
+		CommonType params = new CommonType();
+
+		params.setBaseDir(jsdl.getWorkingDirectory());
+		params.setUserName(jsdl.getUserName());
+		
+		FilesType localFiles = getLocalFiles(localDirectory, "");
+		
+		for (FileType local : localFiles.getFile()) {
+
+			if (!fileOk(local.getPath(), exclude))
+				continue; 
+			
+			if (! local.isIsDirectory()) {
+				putDelta(params, localDirectory, local.getPath());
+			} else if (!createdDirectories.contains(local.getPath())) {
+				String subDir = "";
+				String[] dirTokens = local.getPath().split("/");
+				
+				System.err.println("mkdir: " + jsdl.getWorkingDirectory() + local.getPath());
+				staging.mkdir(jsdl.getWorkingDirectory() + local.getPath(), "0755", jsdl.getUserName());
+				
+				for (String dirToken: dirTokens) {
+					subDir += "/" + dirToken;
+					createdDirectories.add(subDir);
+					System.err.println("add Dir:" + subDir);
+				}
+			}
+		}
+
+	}
+
+	/***
+	 * one-way (update local site) synchronize
+	 * @param jsdl
+	 * @param localDirectory
+	 * @param exclude
+	 * @throws InternalFault
+	 * @throws InvalidPathFault
+	 * @throws DatatypeConfigurationException
+	 * @throws NoSuchAlgorithmException
+	 * @throws IOException
+	 * @throws IOFault
+	 * @throws RsyncFault
+	 */
+	public void remoteToLocal(JSDL jsdl, String localDirectory, List<Pattern> exclude) 
+					throws 
+					InternalFault, 
+					InvalidPathFault,
+					DatatypeConfigurationException, 
+					NoSuchAlgorithmException,
+					IOException, 
+					IOFault, 
+					RsyncFault {
+		
+		CommonType params = new CommonType();
+		
+		params.setBaseDir(jsdl.getWorkingDirectory());
+		params.setUserName(jsdl.getUserName());
+		
+		FilesType remoteFiles = rsync.getFiles(params);
+
+		for (FileType remote : remoteFiles.getFile()) {
+
+			if (fileOk(remote.getPath(), exclude))
+				getDelta(params, localDirectory, remote.getPath());
+
+		}
+	}
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/ARES.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/ARES.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/ARES.java	(revision 1)
@@ -0,0 +1,167 @@
+package com.qcg.comp.sdk;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import com.qcg.comp.sdk.ardl.ARDL;
+import com.qcg.comp.sdk.exceptions.InvalidRequestMessageException;
+import com.qcg.comp.sdk.exceptions.NoMatchingResourcesException;
+import com.qcg.comp.sdk.exceptions.NoSlotsAvailableException;
+import com.qcg.comp.sdk.exceptions.NotAuthorizedException;
+import com.qcg.comp.sdk.exceptions.UnknownReservationIdentifierException;
+import com.qcg.comp.sdk.exceptions.UnsupportedFeatureException;
+import com.qcg.comp.sdk.types.ReservationDocument;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+import com.qcg.comp.stubs.ares.ARESReservationDocumentType;
+import com.qcg.comp.stubs.ares.ARESReservationStatusType;
+import com.qcg.comp.stubs.ares.CreateReservationType;
+import com.qcg.comp.stubs.ares.GetActiveReservationsType;
+import com.qcg.comp.stubs.ares.GetReservationDocumentResponseType;
+import com.qcg.comp.stubs.ares.GetReservationDocumentType;
+import com.qcg.comp.stubs.ares.GetReservationStatusType;
+import com.qcg.comp.stubs.ares.InvalidRequestMessageFault;
+import com.qcg.comp.stubs.ares.NoMatchingResourcesFault;
+import com.qcg.comp.stubs.ares.NoSlotsAvailableFault;
+import com.qcg.comp.stubs.ares.NotAuthorizedFault;
+import com.qcg.comp.stubs.ares.QCGComputingAdvanceReservation;
+import com.qcg.comp.stubs.ares.QCGComputingAdvanceReservationPortType;
+import com.qcg.comp.stubs.ares.TerminateReservationType;
+import com.qcg.comp.stubs.ares.UnknownReservationIdentifierFault;
+import com.qcg.comp.stubs.ares.UnsupportedFeatureFault;
+import com.qcg.core.sdk.QCGCoreService;
+import com.qcg.core.sdk.security.AuthenticationModule;
+
+
+public class ARES extends QCGCoreService {
+
+	public ARES(String hostname, int port, AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer, boolean useWSA)
+			throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer, useWSA);
+	}
+
+	public ARES(String hostname, int port, AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer);
+	}
+
+	public ARES(String hostname, int port, AuthenticationModule am)
+			throws JAXBException {
+		super(hostname, port, am);
+	}
+
+	public static final String QCG_ARES_NS = "http://schemas.qoscosgrid.org/comp/2011/04/ares";
+	protected QCGComputingAdvanceReservationPortType ares;
+	
+	public ARES(String hostname, int port, AuthenticationModule am,
+			boolean useWSA) throws JAXBException{
+		super(hostname, port, am, useWSA);
+		ares = (QCGComputingAdvanceReservationPortType)stubs;
+	}
+
+	@Override
+	@SuppressWarnings("all")
+	protected List<Handler> getHandlersChain() {
+		return null;
+	}
+
+	@Override
+	protected Object getPort(Service service, WebServiceFeature... features) {
+		return ((QCGComputingAdvanceReservation)service).getQCGComputingAdvanceReservation(features);
+	}
+
+	@Override
+	protected Service getService() {
+		return new QCGComputingAdvanceReservation(ARES.class.getResource("/schemas/qcg-comp-ares.wsdl"), new QName(QCG_ARES_NS, "QCGComputingAdvanceReservation"));
+	}
+	
+	public ReservationEndpointReference createReservation(ARDL reservationDocument) throws InvalidRequestMessageException, NoMatchingResourcesException, NoSlotsAvailableException, NotAuthorizedException, UnsupportedFeatureException {
+		CreateReservationType parameters = new CreateReservationType();
+		
+		parameters.setReservationDocument( new ARESReservationDocumentType() );
+		parameters.getReservationDocument().setReservationDefinition(reservationDocument.getReservationDefinition());
+		
+		try {
+			return new ReservationEndpointReference(ares.createReservation(parameters).getReservationIdentifier());
+		} catch (InvalidRequestMessageFault e) {
+			throw new InvalidRequestMessageException(e);
+		} catch (NoMatchingResourcesFault e) {
+			throw new NoMatchingResourcesException(e);
+		} catch (NoSlotsAvailableFault e) {
+			throw new NoSlotsAvailableException(e);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnsupportedFeatureFault e) {
+			throw new UnsupportedFeatureException(e);
+		}
+	}
+	
+	public void terminateReservation(ReservationEndpointReference rEpr) throws NotAuthorizedException, UnknownReservationIdentifierException {
+		TerminateReservationType parameters = new TerminateReservationType();
+		
+		parameters.setReservationIdentifier(rEpr.getEndpointReference(getURL()));
+		
+		try {
+			ares.terminateReservation(parameters);
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnknownReservationIdentifierFault e) {
+			throw new UnknownReservationIdentifierException(e);
+		}
+	}
+	
+	public ARESReservationStatusType getReservationStatus(ReservationEndpointReference rEpr) throws NotAuthorizedException, UnknownReservationIdentifierException {
+		GetReservationStatusType parameters = new GetReservationStatusType();
+		
+		parameters.setReservationIdentifier(rEpr.getEndpointReference(getURL()));
+		
+		try {
+			return ares.getReservationStatus(parameters).getReservationStatus();
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnknownReservationIdentifierFault e) {
+			throw new UnknownReservationIdentifierException(e);
+		}
+	}
+	
+	public ReservationDocument getReservationDocument(ReservationEndpointReference rEpr) throws NotAuthorizedException, UnknownReservationIdentifierException {
+		GetReservationDocumentType parameters = new GetReservationDocumentType();
+		
+		parameters.setReservationIdentifier(rEpr.getEndpointReference(getURL()));
+		GetReservationDocumentResponseType rdt;
+		try {
+			rdt = ares.getReservationDocument(parameters);
+			return new ReservationDocument(new ARDL(rdt.getReservationDocument().getReservationDefinition()), rdt.getLocalReservationId());
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		} catch (UnknownReservationIdentifierFault e) {
+			throw new UnknownReservationIdentifierException(e);
+		}
+	}
+	
+	public List<ReservationEndpointReference> getActiveReservations() throws NotAuthorizedException {
+		
+		List<W3CEndpointReference> w3cList;
+		try {
+			w3cList = ares.getActiveReservations(new GetActiveReservationsType()).getReservationIdentifier();
+			List<ReservationEndpointReference> fedList = new ArrayList<ReservationEndpointReference>(w3cList.size());
+			
+			for (W3CEndpointReference epr : w3cList) {
+				fedList.add(new ReservationEndpointReference(epr));
+			}
+			
+			return fedList;
+		} catch (NotAuthorizedFault e) {
+			throw new NotAuthorizedException(e);
+		}
+
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/jsdl/JSDL.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/jsdl/JSDL.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/jsdl/JSDL.java	(revision 1)
@@ -0,0 +1,604 @@
+package com.qcg.comp.sdk.jsdl;
+
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+import com.qcg.comp.stubs.jsdl.ApplicationType;
+import com.qcg.comp.stubs.jsdl.BoundaryType;
+import com.qcg.comp.stubs.jsdl.CPUArchitectureType;
+import com.qcg.comp.stubs.jsdl.CandidateHostsType;
+import com.qcg.comp.stubs.jsdl.DataStagingType;
+import com.qcg.comp.stubs.jsdl.ExactType;
+import com.qcg.comp.stubs.jsdl.JobDefinitionType;
+import com.qcg.comp.stubs.jsdl.JobDescriptionType;
+import com.qcg.comp.stubs.jsdl.JobIdentificationType;
+import com.qcg.comp.stubs.jsdl.ObjectFactory;
+import com.qcg.comp.stubs.jsdl.OperatingSystemType;
+import com.qcg.comp.stubs.jsdl.OperatingSystemTypeEnumeration;
+import com.qcg.comp.stubs.jsdl.OperatingSystemTypeType;
+import com.qcg.comp.stubs.jsdl.ProcessorArchitectureEnumeration;
+import com.qcg.comp.stubs.jsdl.RangeValueType;
+import com.qcg.comp.stubs.jsdl.ResourcesType;
+import com.qcg.comp.stubs.jsdl.ares.ReservationType;
+import com.qcg.comp.stubs.jsdl.hpcpa.ArgumentType;
+import com.qcg.comp.stubs.jsdl.hpcpa.DirectoryNameType;
+import com.qcg.comp.stubs.jsdl.hpcpa.EnvironmentType;
+import com.qcg.comp.stubs.jsdl.hpcpa.FileNameType;
+import com.qcg.comp.stubs.jsdl.hpcpa.HPCProfileApplicationType;
+import com.qcg.comp.stubs.jsdl.hpcpa.UserNameType;
+
+
+public class JSDL implements Serializable, Cloneable{
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 200L;
+	
+	protected static JAXBContext jaxbCtxt;
+
+	protected String jobName;
+	protected String jobDescription;
+	
+	protected String applicationName;
+	protected String applicationVersion;
+
+	protected String executable;
+	protected String error;
+	protected String input;
+	protected String output;
+	protected String userName;
+	protected String workingDirectory;
+	protected String nativeSpecification;
+	protected List<String> candidateHosts = new LinkedList<String>();
+	protected Integer minCpu;
+	protected Integer maxCpu;
+	protected String operatingSystem;
+	protected String cpuArch;
+	protected String queueName;
+
+	protected List<String> arguments = new LinkedList<String>();
+	protected Map<String, String> environment = new HashMap<String, String>();
+	
+	protected ReservationEndpointReference reservationIdentifier;
+	
+	protected List<JSDLDataStaging> dataStaging = new LinkedList<JSDLDataStaging>();
+
+	protected transient JobDefinitionType job;
+	protected transient String strValue;
+
+	public JSDL(JobDefinitionType jobDef) {
+		job = jobDef;
+		convertFromJobDefinition();
+	}
+	
+	protected static synchronized JAXBContext getJAXBContext() throws JAXBException {
+		
+		if (jaxbCtxt == null) {
+			jaxbCtxt = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
+		}
+		
+		return jaxbCtxt;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public JSDL(Reader jsdlReader) throws JAXBException {
+
+		Unmarshaller um = getJAXBContext().createUnmarshaller();
+		job = ((JAXBElement<JobDefinitionType>)um.unmarshal(jsdlReader)).getValue(); 
+		convertFromJobDefinition();
+	}
+	
+	public JSDL(String jobName) {
+		this.jobName = jobName;
+	}
+	
+	protected void convertFromJobDefinition() {
+		if  (job.getJobDescription().getJobIdentification()!= null) {
+			jobName = job.getJobDescription().getJobIdentification().getJobName();
+			jobDescription = job.getJobDescription().getJobIdentification().getDescription();
+		}
+		
+		if  (job.getJobDescription().getApplication() != null) {
+
+			applicationName = job.getJobDescription().getApplication().getApplicationName();
+			applicationVersion = job.getJobDescription().getApplication().getApplicationVersion();
+			
+			if  (job.getJobDescription().getApplication().getHPCProfileApplication()!= null) {
+				HPCProfileApplicationType app = job.getJobDescription().getApplication().getHPCProfileApplication();
+				
+				if (app.getExecutable() != null)
+					executable = app.getExecutable().getValue();
+				
+				for (ArgumentType at : app.getArgument()) {
+					arguments.add(at.getValue());
+				}
+				
+				input = app.getInput() != null ? app.getInput().getValue() : null;
+				output = app.getOutput() != null ? app.getOutput().getValue() : null;
+				error = app.getError() != null ? app.getError().getValue() : null;
+			 	workingDirectory = app.getWorkingDirectory() != null ? app.getWorkingDirectory().getValue() : null;
+			 	userName = app.getUserName() != null ? app.getUserName().getValue() : null;
+				
+				for (EnvironmentType et  : app.getEnvironment()) {
+					environment.put(et.getName(), et.getValue());
+				}
+			}
+		}
+		
+		if (job.getJobDescription().getResources() != null) {
+			ResourcesType res = job.getJobDescription().getResources();
+			
+			if (res.getReservation() != null) 
+				reservationIdentifier = new ReservationEndpointReference(job.getJobDescription().getResources().getReservation().getReservationIdentifier());
+			else
+				reservationIdentifier = null;
+			
+			if (res.getNativeSpecification() != null) {
+				nativeSpecification = res.getNativeSpecification();
+			} else {
+				nativeSpecification = null;
+			}
+			
+			if (res.getQueue() != null) {
+				queueName = res.getQueue();
+			} else {
+				queueName = null;
+			}
+			
+			if (res.getTotalCPUCount() != null) {
+				if (res.getTotalCPUCount().getExact().size() == 1) {
+					minCpu = maxCpu = new Integer((int)res.getTotalCPUCount().getExact().get(0).getValue());
+				} 
+				
+				if (res.getTotalCPUCount().getLowerBoundedRange() != null) {
+					minCpu = new Integer((int)res.getTotalCPUCount().getLowerBoundedRange().getValue());
+				}
+				
+				if (res.getTotalCPUCount().getUpperBoundedRange() != null) {
+					maxCpu = new Integer((int)res.getTotalCPUCount().getUpperBoundedRange().getValue());
+				}
+			} else {
+				minCpu = null;
+				maxCpu = null;
+			}
+			
+			if (res.getCPUArchitecture() != null) {
+				cpuArch = res.getCPUArchitecture().getCPUArchitectureName().value();
+			} else {
+				cpuArch = null;
+			}
+			
+			if (res.getOperatingSystem() != null) {
+				operatingSystem = res.getOperatingSystem().getOperatingSystemType().getOperatingSystemName().value();
+			} else {
+				operatingSystem = null;
+			}
+			
+			if (res.getCandidateHosts() != null) {
+				candidateHosts.addAll(res.getCandidateHosts().getHostName());
+			}
+			
+		}
+		
+		for (DataStagingType ds : job.getJobDescription().getDataStaging()) {
+			dataStaging.add(new JSDLDataStaging(ds));
+		}
+		
+	}
+	
+	protected void convertToJobDefinition() {
+		if (job!= null)
+			return;
+		
+		job = new JobDefinitionType();
+
+		JobDescriptionType jobDesc = new JobDescriptionType();
+		job.setJobDescription(jobDesc);
+		
+		if (jobName != null) {
+			jobDesc.setJobIdentification(new JobIdentificationType());
+			jobDesc.getJobIdentification().setJobName(jobName);
+		}
+		
+		if (jobDescription != null) {
+			if (jobDesc.getJobIdentification() == null) {
+				jobDesc.setJobIdentification(new JobIdentificationType());
+			}
+			
+			jobDesc.getJobIdentification().setDescription(jobDescription);
+		}
+		
+		if (applicationName != null) {
+			jobDesc.setApplication(new ApplicationType());
+			jobDesc.getApplication().setApplicationName(applicationName);
+			jobDesc.getApplication().setApplicationVersion(applicationVersion);
+		}
+		
+		if (executable != null ||
+				error != null ||
+				input != null ||
+				output!= null ||
+				workingDirectory != null ||
+				userName != null ||
+				arguments.size() != 0 ||
+				environment.size() != 0) {
+			
+			HPCProfileApplicationType app = new HPCProfileApplicationType();
+			jobDesc.setApplication( jobDesc.getApplication() == null ? new ApplicationType() : jobDesc.getApplication());
+			jobDesc.getApplication().setHPCProfileApplication(app);
+			
+			app.setExecutable(createFileNameType(executable));
+			app.setInput(createFileNameType(input));
+			app.setOutput(createFileNameType(output));
+			app.setError(createFileNameType(error));
+			
+			
+			if (workingDirectory != null) {
+				app.setWorkingDirectory(new DirectoryNameType());
+				app.getWorkingDirectory().setValue(workingDirectory);
+			}
+			
+			if (userName != null) {
+				app.setUserName(new UserNameType());
+				app.getUserName().setValue(userName);
+			}
+			
+			for (String arg : arguments) {
+				ArgumentType at = new ArgumentType();
+				at.setValue(arg);
+				app.getArgument().add(at);
+			}
+			
+			for (String varName : environment.keySet()) {
+				String varValue = environment.get(varName);
+				EnvironmentType et = new EnvironmentType();
+				
+				et.setName(varName);
+				et.setValue(varValue);
+				
+				app.getEnvironment().add(et);
+			}		
+		}
+		
+		if (reservationIdentifier != null || 
+				nativeSpecification != null ||
+				candidateHosts.size() != 0 ||
+				cpuArch != null ||
+				operatingSystem != null ||
+				minCpu != null ||
+				maxCpu != null ||
+				queueName != null) {
+			jobDesc.setResources(new ResourcesType());	
+		}
+		
+		if (reservationIdentifier != null) {
+			jobDesc.getResources().setReservation(new ReservationType());
+			jobDesc.getResources().getReservation().setReservationIdentifier(reservationIdentifier.getEndpointReference());
+		}
+		
+		if (nativeSpecification != null) {
+			jobDesc.getResources().setNativeSpecification(nativeSpecification);
+		}
+		
+		if (candidateHosts.size() > 0) {
+			jobDesc.getResources().setCandidateHosts(new CandidateHostsType());
+			jobDesc.getResources().getCandidateHosts().getHostName().addAll(candidateHosts);
+		}
+		
+		if (cpuArch != null) {
+			CPUArchitectureType cat = new CPUArchitectureType();
+			cat.setCPUArchitectureName(ProcessorArchitectureEnumeration.valueOf(cpuArch));
+			jobDesc.getResources().setCPUArchitecture(cat);
+		}
+		
+		if (operatingSystem != null) {
+			OperatingSystemType ost =  new OperatingSystemType();
+			ost.setOperatingSystemType(new OperatingSystemTypeType());
+			ost.getOperatingSystemType().setOperatingSystemName(OperatingSystemTypeEnumeration.valueOf(operatingSystem));
+		}
+		
+		if (minCpu != null || maxCpu != null) {
+			RangeValueType rvt = new RangeValueType();
+			
+			if (minCpu == null)
+				minCpu = maxCpu;
+			else if (maxCpu == null)
+				maxCpu = minCpu;
+			
+			if (minCpu.equals(maxCpu)) {
+				ExactType et = new ExactType();
+				et.setValue(minCpu.doubleValue());
+				rvt.getExact().add(et);
+			} else {
+				BoundaryType lb = new BoundaryType();
+				lb.setValue(minCpu.doubleValue());
+				
+				rvt.setLowerBoundedRange(lb);
+				
+				BoundaryType ub = new BoundaryType();
+				ub.setValue(maxCpu.doubleValue());
+				
+				rvt.setUpperBoundedRange(ub);
+			}
+			
+			jobDesc.getResources().setTotalCPUCount(rvt);
+		}
+		
+		if (queueName != null) {
+			jobDesc.getResources().setQueue(queueName);
+		}
+		
+		for (JSDLDataStaging ds : dataStaging) {
+			jobDesc.getDataStaging().add(ds.getDataStagingElement());
+		}
+		
+	}
+
+	protected FileNameType createFileNameType(String fileName) {
+		if (fileName == null)
+			return null;
+		
+		FileNameType fn = new FileNameType();
+		fn.setValue(fileName);
+		
+		return fn;
+	}
+	
+	public String getApplicationName() {
+		return applicationName;
+	}
+	public String getApplicationVersion() {
+		return applicationVersion;
+	}
+	
+	public List<String> getArguments() {
+		invalidate();
+		
+		return arguments;
+	}
+	
+	public List<JSDLDataStaging> getDataStaging() {
+		invalidate();
+
+		return dataStaging;
+	}
+	
+	public Map<String, String> getEnvironment() {
+		invalidate();
+		
+		return environment;
+	}
+	
+	public String getError() {
+		
+		return error;
+	}
+	
+	public String getExecutable() {
+		
+		return executable;
+	}
+	
+	public String getInput() {
+		return input;
+	}
+	
+	public String getJobDescription() {
+		
+		return jobDescription;
+	}
+	
+	public String getJobName() {
+		
+		return jobName;
+	}
+	
+	public String getOutput() {
+		
+		return output;
+	}
+
+	public ReservationEndpointReference getReservationIdentifier() {
+		
+		return reservationIdentifier;
+	}
+
+	public String getUserName() {
+		
+		return userName;
+	}
+
+	public String getWorkingDirectory() {
+
+		return workingDirectory;
+	}
+	
+	public String getNativeSpecification() {
+		
+		return nativeSpecification;
+	}
+
+	protected void invalidate() {
+		strValue = null;
+		job = null;
+	}
+
+	public void setApplicationName(String applicationName) {
+		invalidate();
+
+		this.applicationName = applicationName;
+	}
+
+	public void setApplicationVersion(String applicationVersion) {
+		invalidate();
+
+		this.applicationVersion = applicationVersion;
+	}
+
+	public void setError(String error) {
+		invalidate();
+
+		this.error = error;
+	}
+
+	public void setExecutable(String executable) {
+		invalidate();
+		
+		this.executable = executable;
+	}
+
+	public void setInput(String input) {
+		invalidate();
+
+		this.input = input;
+	}
+
+	public void setJobDescription(String jobDescription) {
+		invalidate();
+
+		this.jobDescription = jobDescription;
+	}
+
+	public void setJobName(String jobName) {
+		invalidate();
+
+		this.jobName = jobName;
+	}
+
+	public void setOutput(String output) {
+		invalidate();
+
+		this.output = output;
+	}
+
+	public void setReservationIdentifier(ReservationEndpointReference reservationIdentifier) {
+		invalidate();
+		
+		this.reservationIdentifier = reservationIdentifier;
+	}
+
+	public void setUserName(String userName) {
+		invalidate();
+
+		this.userName = userName;
+	}
+	
+	public void setNativeSpecification(String nativeSpecification) {
+		invalidate();
+
+		this.nativeSpecification = nativeSpecification;
+	}
+
+	public void setWorkingDirectory(String workingDirectory) {
+		invalidate();
+
+		this.workingDirectory = workingDirectory;
+	}
+
+	public JobDefinitionType toJobDefinition() {
+		convertToJobDefinition();
+		return job;
+	}
+
+	public Integer getMinCpu() {
+		return minCpu;
+	}
+
+	public void setMinCpu(Integer minCpu) {
+		invalidate();
+		
+		this.minCpu = minCpu;
+	}
+
+	public Integer getMaxCpu() {
+		return maxCpu;
+	}
+
+	public void setMaxCpu(Integer maxCpu) {
+		invalidate();
+		
+		this.maxCpu = maxCpu;
+	}
+
+	public String getOperatingSystem() {
+		return operatingSystem;
+	}
+
+	public void setOperatingSystem(String operatingSystem) {
+		invalidate();
+		
+		this.operatingSystem = operatingSystem;
+	}
+
+	public String getCpuArch() {
+		return cpuArch;
+	}
+
+	public void setCpuArch(String cpuArch) {
+		invalidate();
+		
+		this.cpuArch = cpuArch;
+	}
+	
+	public String getQueueName() {
+		return queueName;
+	}
+
+	public void setQueueName(String queueName) {
+		invalidate();
+		
+		this.queueName = queueName;
+	}
+
+	public List<String> getCandidateHosts() {
+		invalidate();
+		
+		return candidateHosts;
+	}
+
+	public String toString() {
+		
+		try {
+			if (strValue == null) {
+				convertToJobDefinition();
+				Marshaller m = getJAXBContext().createMarshaller();
+				m.setProperty("jaxb.formatted.output",new Boolean(true)); 
+
+				StringWriter sw  = new StringWriter(512);
+				m.marshal((new ObjectFactory()).createJobDefinition(job), sw);
+				strValue = sw.getBuffer().toString();
+			}
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			strValue = "Unable to marshal JSDL:" + ex.getMessage();
+		}
+		
+		return strValue;
+	}
+
+	@Override
+	public Object clone() throws CloneNotSupportedException {
+		String jsdlStr = this.toString();
+		try {
+			return new JSDL(new StringReader(jsdlStr));
+		} catch (JAXBException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/jsdl/JSDLDataStaging.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/jsdl/JSDLDataStaging.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/jsdl/JSDLDataStaging.java	(revision 1)
@@ -0,0 +1,137 @@
+package com.qcg.comp.sdk.jsdl;
+
+import java.io.Serializable;
+
+import com.qcg.comp.stubs.hpcp.fs.CredentialType;
+import com.qcg.comp.stubs.jsdl.CreationFlagEnumeration;
+import com.qcg.comp.stubs.jsdl.DataStagingType;
+import com.qcg.comp.stubs.jsdl.SourceTargetType;
+
+
+
+public class JSDLDataStaging implements Serializable{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 200L;
+	
+	protected String fileName;
+	protected String sourceURL;
+	protected String targetURL;
+	protected boolean deleteOnTermination;
+	protected CreationFlagEnumeration creationFlag;
+	protected transient CredentialType credentials;
+	protected String fileMode;
+	protected Integer offset;
+	
+	public JSDLDataStaging(String fileName, String sourceURL, String targetURL) {
+		this(CreationFlagEnumeration.OVERWRITE, false, fileName, sourceURL, targetURL);
+	}
+	
+	public JSDLDataStaging(CreationFlagEnumeration creationFlag,
+			boolean deleteOnTermination, String fileName, String sourceURL,
+			String targetURL) {
+		this.creationFlag = creationFlag;
+		this.deleteOnTermination = deleteOnTermination;
+		this.fileName = fileName;
+		this.sourceURL = sourceURL;
+		this.targetURL = targetURL;
+	}
+	
+	public JSDLDataStaging(DataStagingType ds) {
+		this.creationFlag = ds.getCreationFlag();
+		this.deleteOnTermination = ds.isDeleteOnTermination() == null ? false : ds.isDeleteOnTermination();
+		this.fileName =  ds.getFileName();
+		if (ds.getSource() != null)
+			this.sourceURL = ds.getSource().getURI();
+		
+		if (ds.getTarget() != null)
+			this.targetURL = ds.getTarget().getURI();
+		
+		this.credentials = ds.getCredential();
+		
+		this.fileMode = ds.getFileMode();
+		this.offset = ds.getOffset();
+	}
+
+	public String getFileName() {
+		return fileName;
+	}
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+	public String getSourceURL() {
+		return sourceURL;
+	}
+	public void setSourceURL(String sourceURL) {
+		this.sourceURL = sourceURL;
+	}
+	public String getTargetURL() {
+		return targetURL;
+	}
+	public void setTargetURL(String targetURL) {
+		this.targetURL = targetURL;
+	}
+	public boolean isDeleteOnTermination() {
+		return deleteOnTermination;
+	}
+	public void setDeleteOnTermination(boolean deleteOnTermination) {
+		this.deleteOnTermination = deleteOnTermination;
+	}
+	public CreationFlagEnumeration getCreationFlag() {
+		return creationFlag;
+	}
+	public void setCreationFlag(CreationFlagEnumeration creationFlag) {
+		this.creationFlag = creationFlag;
+	}
+	
+	public CredentialType getCredentials() {
+		return credentials;
+	}
+
+	public void setCredentials(CredentialType credentials) {
+		this.credentials = credentials;
+	}
+	
+	public String getFileMode() {
+	    return fileMode;
+	}
+
+	public void setFileMode(String fileMode) {
+	    this.fileMode = fileMode;
+	}
+
+	public Integer getOffset() {
+	    return offset;
+	}
+
+	public void setOffset(Integer offset) {
+	    this.offset = offset;
+	}	
+
+	public DataStagingType getDataStagingElement() {
+		DataStagingType ds = new DataStagingType();
+		
+		ds.setDeleteOnTermination(deleteOnTermination);
+		ds.setCreationFlag(creationFlag);
+		ds.setFileName(fileName);
+		
+		if (sourceURL != null) {
+			ds.setSource(new SourceTargetType());
+			ds.getSource().setURI(sourceURL);
+		}
+		
+		if (targetURL != null) {
+			ds.setTarget(new SourceTargetType());
+			ds.getTarget().setURI(targetURL);
+		}
+		
+		ds.setCredential(credentials);
+		
+		ds.setFileMode(fileMode);
+		ds.setOffset(offset);
+		
+		return ds;
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGSocks.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGSocks.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/QCGSocks.java	(revision 1)
@@ -0,0 +1,65 @@
+package com.qcg.comp.sdk;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.handler.Handler;
+
+import com.qcg.comp.stubs.socks.NotAuthorizedFault;
+import com.qcg.comp.stubs.socks.QCGComputingSocks;
+import com.qcg.comp.stubs.socks.QCGComputingSocksPortType;
+import com.qcg.core.sdk.QCGCoreService;
+import com.qcg.core.sdk.security.AuthenticationModule;
+
+public class QCGSocks extends QCGCoreService {
+
+	protected QCGComputingSocksPortType port;
+
+	public QCGSocks(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer, boolean useWSA)
+			throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer, useWSA);
+		this.port = (QCGComputingSocksPortType) stubs;
+	}
+
+	public QCGSocks(String hostname, int port,
+			AuthenticationModule transportLayer,
+			AuthenticationModule messageLayer) throws JAXBException {
+		super(hostname, port, transportLayer, messageLayer);
+		this.port = (QCGComputingSocksPortType) stubs;
+	}
+
+	public QCGSocks(String hostname, int port, AuthenticationModule am)
+			throws JAXBException {
+		super(hostname, port, am);
+		this.port = (QCGComputingSocksPortType) stubs;
+	}
+
+	public static final String QCG_SOCKS_NS = "http://schemas.qoscosgrid.org/comp/2011/04/socks";
+
+	@Override
+	protected List<Handler> getHandlersChain() {
+		return null;
+	}
+
+	@Override
+	protected Object getPort(Service service, WebServiceFeature... features) {
+		return ((QCGComputingSocks) service).getQCGComputingSocks(features);
+	}
+
+	@Override
+	protected Service getService() {
+		return new QCGComputingSocks(
+				QCGSocks.class.getResource("/schemas/qcg-comp-socks.wsdl"),
+				new QName(QCG_SOCKS_NS, "QCGComputingSocks"));
+	}
+
+	public synchronized String getToken() throws NotAuthorizedFault {
+		return port.getConnectionToken(null).getSecurityToken();
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/Params.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/Params.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/Params.java	(revision 1)
@@ -0,0 +1,9 @@
+package com.qcg.comp.sdk.rsync;
+
+public interface Params {
+
+    public static final int STRONG_SUM_LENGTH = 8;
+    public static final int BLOCK_LENGTH = 2048;
+    public static final short CHAR_OFFSET = 31;
+    public static final int CHUNK_SIZE = 1024 * 1024;
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/DeltaDataSource.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/DeltaDataSource.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/DeltaDataSource.java	(revision 1)
@@ -0,0 +1,33 @@
+package com.qcg.comp.sdk.rsync;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class DeltaDataSource implements DataSource {
+
+    private DeltaInputStream input;
+    
+    public DeltaDataSource(DeltaInputStream in) {
+	input = in;
+    }
+    
+    public String getContentType() {
+	return "application/octet-stream";
+    }
+
+    public InputStream getInputStream() throws IOException {
+	return input;
+    }
+
+    public String getName() {	
+	return null;
+    }
+
+    public OutputStream getOutputStream() throws IOException {
+	return null;
+    }
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/DeltaInputStream.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/DeltaInputStream.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/DeltaInputStream.java	(revision 1)
@@ -0,0 +1,175 @@
+package com.qcg.comp.sdk.rsync;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.metastatic.rsync.Checksum32;
+import org.metastatic.rsync.ChecksumPair;
+import org.metastatic.rsync.Configuration;
+import org.metastatic.rsync.DataBlock;
+import org.metastatic.rsync.Delta;
+import org.metastatic.rsync.ListenerException;
+import org.metastatic.rsync.MatcherEvent;
+import org.metastatic.rsync.MatcherListener;
+import org.metastatic.rsync.MatcherStream;
+import org.metastatic.rsync.Offsets;
+import org.metastatic.rsync.Rdiff;
+
+public class DeltaInputStream extends InputStream {
+
+    private Configuration c;
+    private MatcherStream match;
+    private InputStream in;
+    private byte[] buffer = new byte[1024*1024];
+    private int bufferPos = 0;
+    private int bufferAvail = 0;
+
+    private void write(byte[] bytes) {	
+	for (byte b : bytes)
+	    writeByte(b);	    
+    }
+
+    private void writeByte(byte b) {
+	if(bufferAvail == buffer.length) {
+	    byte []newBuffer = new byte[buffer.length*2];
+	    
+	    for(int i = 0; i < buffer.length; ++i)
+		newBuffer[i] = buffer[i];
+	    
+	    buffer = newBuffer;
+	}
+	buffer[bufferAvail++] = b; 
+    }
+
+    private void writeInt(int i) {
+	writeByte((byte) ((i >>> 24) & 0xff));
+	writeByte((byte) ((i >>> 16) & 0xff));
+	writeByte((byte) ((i >>> 8) & 0xff));
+	writeByte((byte) (i & 0xff));
+    }
+
+    private void writeInt(long l, int len) {
+	for (int i = len - 1; i >= 0; i--) {
+	    writeByte((byte) ((int) (l >>> i * 8) & 0xff));
+	}
+    }
+
+    private void writeCopy(Offsets off) {
+	writeByte(Rdiff.OP_COPY_N4_N4);
+	writeInt(off.getOldOffset(), 4);
+	writeInt(off.getBlockLength());
+    }
+
+    private static int integerLength(long l) {
+	if ((l & ~0xffL) == 0) {
+	    return 1;
+	} else if ((l & ~0xffffL) == 0) {
+	    return 2;
+	} else if ((l & ~0xffffffffL) == 0) {
+	    return 4;
+	}
+	return 8;
+    }
+
+    private void writeLiteral(DataBlock d) {
+	byte cmd = 0;
+	int param_len;
+
+	switch (param_len = integerLength(d.getBlockLength())) {
+	case 1:
+	    cmd = Rdiff.OP_LITERAL_N1;
+	    break;
+	case 2:
+	    cmd = Rdiff.OP_LITERAL_N2;
+	    break;
+	case 4:
+	    cmd = Rdiff.OP_LITERAL_N4;
+	    break;
+	}
+
+	writeByte(cmd);
+	writeInt(d.getBlockLength(), param_len);
+	write(d.getData());
+    }
+
+    public DeltaInputStream(List<ChecksumPair> sums, InputStream in) throws NoSuchAlgorithmException, IOException {
+	c = new Configuration();
+	c.strongSum = MessageDigest.getInstance("MD4");
+	c.weakSum = new Checksum32(Params.CHAR_OFFSET);
+	c.blockLength = Params.BLOCK_LENGTH;
+	c.strongSumLength = Params.STRONG_SUM_LENGTH;
+	match = new MatcherStream(c);
+	match.setChecksums(sums);
+	writeInt(Rdiff.DELTA_MAGIC);
+	match.addListener(new MatcherListener() {
+	    public void update(MatcherEvent me) throws ListenerException {		
+		Delta d = me.getDelta();
+		if (d instanceof Offsets) {
+		    writeCopy((Offsets) d);
+		} else if (d instanceof DataBlock) {
+		    writeLiteral((DataBlock) d);
+		}		
+	    }
+	});
+	this.in = in;	
+    }
+
+    int state = 0;
+    byte[] buf = new byte[10240];
+
+    private boolean step() throws IOException {
+	int len;
+	
+	switch (state) {
+	case 0:
+	    if ((len = in.read(buf)) != -1) {		
+		try {
+		    match.update(buf, 0, len);
+		} catch (ListenerException le) {
+		    throw (IOException) le.getCause();
+		}
+	    } else
+		state++;
+	    break;
+	case 1:
+	    try {
+		match.doFinal();
+	    } catch (ListenerException le) {
+		throw (IOException) le.getCause();
+	    }
+	    writeByte((byte) 0);
+	    state++;
+	    break;
+	default:
+	    return false;
+	}
+	return true;
+    }
+
+    @Override
+    public int read() throws IOException {
+	int val;
+	
+	//we reached the end of the buffer, buffer must be refilled 
+	if(bufferPos == bufferAvail) {
+	    bufferAvail = 0;
+	    bufferPos = 0;
+	}
+
+	while (bufferAvail == 0 && step())
+	    ;
+		
+	if (bufferAvail == 0)
+	    val = -1;
+	else {
+	    val = buffer[bufferPos++];	    
+	}	
+	
+	return val;
+    }
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/GetDeltaHandler.java
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/GetDeltaHandler.java	(revision 1)
+++ trunk/java/WSIT/QCGComputingSDK/src/main/java/com/qcg/comp/sdk/rsync/GetDeltaHandler.java	(revision 1)
@@ -0,0 +1,258 @@
+package com.qcg.comp.sdk.rsync;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInputStream;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.RandomAccessFile;
+
+import org.metastatic.rsync.DataBlock;
+import org.metastatic.rsync.Delta;
+import org.metastatic.rsync.Offsets;
+import org.metastatic.rsync.Rdiff;
+
+import com.qcg.core.sdk.attachments.FileStagingHandler;
+
+public class GetDeltaHandler implements FileStagingHandler {
+
+	private String origin;
+	private RandomAccessFile in = null;
+	private RandomAccessFile out = null;
+	private long offset = 0;
+	private DataInputStream data;
+	
+	public static final int OP_COPY_N1_N4 = 0x47;
+    public static final int OP_COPY_N2_N4 = 0x4b;
+
+	public GetDeltaHandler(String origin) throws FileNotFoundException,
+			IOException {
+		this.origin = origin;
+	}
+
+	public InputStream stageIn(String sourceFileName) throws IOException {
+		return null;
+	}
+
+	protected void applyDelta(Delta o) throws IOException {
+		if (o instanceof DataBlock) {
+			long off = ((DataBlock) o).getOffset();
+			out.seek(off);
+			out.write(((DataBlock) o).getData());
+		} else if (o instanceof Offsets) {
+			if (in == null) {
+				throw new IOException(
+						"original file does not exist or not readable");
+			}
+			int len = ((Offsets) o).getBlockLength();
+			long off1 = ((Offsets) o).getOldOffset();
+			long off2 = ((Offsets) o).getNewOffset();
+			byte[] buf = new byte[len];
+			in.seek(off1);
+			in.read(buf);
+			out.seek(off2);
+			out.write(buf);
+		}
+	}
+
+	private static long readInt(int len, InputStream in) throws IOException {
+		long i = 0;
+		for (int j = len - 1; j >= 0; j--) {
+			int k = in.read();
+			if (k == -1)
+				throw new EOFException();
+			i |= (k & 0xff) << 8 * j;
+		}
+		return i;
+	}
+
+	private static int readInt(InputStream in) throws IOException {
+		int i = 0;
+		for (int j = 3; j >= 0; j--) {
+			int k = in.read();
+			if (k == -1)
+				throw new EOFException();
+			i |= (k & 0xff) << 8 * j;
+		}
+		System.err.println("readInt" + i);
+		return i;
+	}
+
+
+
+	protected Delta readDelta() throws IOException {
+
+		int command;
+		byte[] buf;
+		
+		if ((command = data.read()) != -1) {
+
+			switch (command) {
+			case Rdiff.OP_END:
+				return null;
+
+			case Rdiff.OP_LITERAL_N1:
+			{
+				buf = new byte[(int) readInt(1, data)];
+				data.readFully(buf);
+				DataBlock db = new DataBlock(offset, buf);
+				offset += buf.length;
+				return db;
+			}
+				
+			case Rdiff.OP_LITERAL_N2: {
+				buf = new byte[(int) readInt(2, data)];
+				data.readFully(buf);
+				DataBlock db = new DataBlock(offset, buf);
+				offset += buf.length;
+				return db;
+			}
+
+			case Rdiff.OP_LITERAL_N4: {
+				buf = new byte[(int) readInt(4, data)];
+				data.readFully(buf);
+				DataBlock db = new DataBlock(offset, buf);
+				offset += buf.length;
+				return db;
+			}
+
+			case Rdiff.OP_COPY_N1_N1: {
+				int oldOff = (int) readInt(1, data);
+				int bs = (int) readInt(1, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+
+			case Rdiff.OP_COPY_N1_N2: {
+				int oldOff = (int) readInt(1, data);
+				int bs = (int) readInt(2, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+			
+			case GetDeltaHandler.OP_COPY_N1_N4: {
+				int oldOff = (int) readInt(1, data);
+				int bs = (int) readInt(4, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+
+			case Rdiff.OP_COPY_N2_N1: {
+				int oldOff = (int) readInt(2, data);
+				int bs = (int) readInt(1, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+
+			case Rdiff.OP_COPY_N2_N2: {
+				int oldOff = (int) readInt(2, data);
+				int bs = (int) readInt(2, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+			
+			case GetDeltaHandler.OP_COPY_N2_N4: {
+				int oldOff = (int) readInt(2, data);
+				int bs = (int) readInt(4, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+
+			case Rdiff.OP_COPY_N4_N1: {
+				int oldOff = (int) readInt(4, data);
+				int bs = (int) readInt(1, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+
+			case Rdiff.OP_COPY_N4_N2: {
+				int oldOff = (int) readInt(4, data);
+				int bs = (int) readInt(2, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+
+			case Rdiff.OP_COPY_N4_N4: {
+				int oldOff = (int) readInt(4, data);
+				int bs = (int) readInt(4, data);
+				Offsets o = new Offsets(oldOff, offset, bs);
+				offset += bs;
+				return o;
+			}
+			
+
+			default:
+
+				throw new IOException("Bad delta command: 0x"
+						+ Integer.toHexString(command));
+			}
+		}
+		return null;
+	}
+
+	public void stageOut(String attachementName, InputStream stream)
+			throws IOException {
+		File output = File.createTempFile("qcgrsync", null);
+		out = new RandomAccessFile(output, "rw");
+		try {
+			in = new RandomAccessFile(new File(origin), "r");
+		} catch (IOException ignore) {
+		}
+
+		data = new DataInputStream(stream);
+		offset = 0;
+
+		int header = readInt(data);
+		if (header != Rdiff.DELTA_MAGIC) {
+			throw new IOException("Bad delta header: 0x"
+					+ Integer.toHexString(header));
+		}
+
+		System.err.println("stageOut:" + attachementName);
+		Delta d;
+		while ((d = readDelta()) != null) {
+			applyDelta(d);
+		}
+
+		if (in != null)
+			in.close();
+
+		out.close();
+
+		File o = new File(origin);
+		o.getParentFile().mkdirs();
+		moveFile(output.getAbsolutePath(), o.getAbsolutePath());
+	}
+	
+	public static void moveFile(String source, String destination) throws IOException {
+		BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(new File(source)));
+		BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(new File(destination)));
+		
+		try {
+			byte[] buffer = new byte[4096];
+			int bytesRead = 0;
+			
+			while ((bytesRead = inputStream.read(buffer)) != -1) {
+				outputStream.write(buffer, 0, bytesRead);
+			}
+		} finally {
+			inputStream.close();
+			outputStream.close();
+		}
+		
+	}
+
+}
Index: trunk/java/WSIT/QCGComputingSDK/pom.xml
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/pom.xml	(revision 1180)
+++ trunk/java/WSIT/QCGComputingSDK/pom.xml	(revision 1)
@@ -4,6 +4,6 @@
    <modelVersion>4.0.0</modelVersion>
    <artifactId>QCGComputingSDK</artifactId>
-   <groupId>org.qcg</groupId>
-   <version>4.0.0</version>
+   <groupId>com.qcg</groupId>
+   <version>2.2.0</version>
    <url>http://maven.apache.org</url>
    <dependencies>
@@ -15,7 +15,7 @@
       </dependency>
       <dependency>
-         <groupId>org.qcg</groupId>
+         <groupId>com.qcg</groupId>
          <artifactId>QCGCoreSDK</artifactId>
-         <version>4.0.0</version>
+         <version>2.1.0</version>
       </dependency>
       <dependency>
@@ -24,22 +24,10 @@
 	 <version>0.3</version>
       </dependency>
-     <dependency>
+      <dependency>
       	<groupId>org.jvnet.staxex</groupId>
       	<artifactId>stax-ex</artifactId>
       	<version>1.2</version>
       </dependency>
-      <!-- dependency>
-		<groupId>com.sun.xml.ws</groupId>
-		<artifactId>jaxws-rt</artifactId>
-		<version>2.2.8</version>
-	  </dependency-->
    </dependencies>
-   <repositories>
-   		<repository>
-			<id>mvnrepository.org</id>
-			<name>MVNRepository</name>
-			<url>http://central.maven.org/maven2/</url>
-		</repository>
-   </repositories>
    <pluginRepositories>
       <pluginRepository>
@@ -80,28 +68,6 @@
                <verbose>true</verbose>
                <xnocompile>true</xnocompile>
-	       <vmArgs>
-	       <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
-	       </vmArgs>
             </configuration>
          </plugin>
-	 <plugin>
-		 <groupId>org.apache.maven.plugins</groupId>
-		 <artifactId>maven-dependency-plugin</artifactId>
-		 <executions>
-			 <execution>
-				 <id>copy-dependencies</id>
-				 <phase>prepare-package</phase>
-				 <goals>
-					 <goal>copy-dependencies</goal>
-				 </goals>
-				 <configuration>
-					 <outputDirectory>${basedir}/deps</outputDirectory>
-					 <overWriteReleases>false</overWriteReleases>
-					 <overWriteSnapshots>false</overWriteSnapshots>
-					 <overWriteIfNewer>true</overWriteIfNewer>
-				 </configuration>
-			 </execution>
-		 </executions>
-	 </plugin>
          <plugin>
             <artifactId>maven-assembly-plugin</artifactId>
@@ -133,13 +99,8 @@
          <plugin>
             <artifactId>maven-compiler-plugin</artifactId>
-	    <version>3.3</version>
-	    <configuration>
-		    <source>1.8</source>
-		    <target>1.8</target>
-		    <fork>true</fork>
-		    <compilerArgs>
-			    <arg>-XDignore.symbol.file</arg>
-		    </compilerArgs>
-	    </configuration>
+            <configuration>
+               <source>1.5</source>
+               <target>1.5</target>
+            </configuration>
          </plugin>
       </plugins>
Index: trunk/java/WSIT/QCGComputingSDK/qcg-comp-client.sh
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/qcg-comp-client.sh	(revision 1139)
+++ trunk/java/WSIT/QCGComputingSDK/qcg-comp-client.sh	(revision 1)
@@ -6,5 +6,5 @@
 DEBUG=false
 pwd
-CP="$QCG_COMP_HOME/target/QCGComputingSDK-4.0.0-jar-with-dependencies.jar"
+CP="$QCG_COMP_HOME/QCGComputingSDK-2.2.0.jar"
 
 for jar in $QCG_COMP_HOME/lib/*.jar; do
@@ -13,3 +13,3 @@
 
 
-java -Dqcg.comp.service.url=$QCG_COMP_SERVICE_URL -Dqcg.debug=$DEBUG -cp $CP org.qcg.comp.client.QCGComputingClient $*
+java -Dqcg.comp.service.url=$QCG_COMP_SERVICE_URL -Dqcg.debug=$DEBUG -cp $CP com.qcg.comp.client.QCGComputingClient $*
Index: trunk/java/WSIT/QCGComputingSDK/README
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/README	(revision 1139)
+++ trunk/java/WSIT/QCGComputingSDK/README	(revision 1)
@@ -13,3 +13,3 @@
 For sample usage please consult one of the example test case, e.g.:
 
-src/test/java/com/qcg/comp/tests/QCGCompExample.java
+QCGComputingSDK-2.1/src/test/java/com/qcg/comp/tests/QCGCompExample.java
Index: trunk/java/WSIT/QCGComputingSDK/.classpath
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/.classpath	(revision 755)
+++ trunk/java/WSIT/QCGComputingSDK/.classpath	(revision 1)
@@ -1,43 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
-  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
-  <classpathentry kind="src" path="target/jaxws/wsimport/java" including="**/*.java"/>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/xml/ws/jaxws-api/2.1/jaxws-api-2.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0/stax-api-1.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/xml/webservices-api/1.1.2-SNAPSHOT/webservices-api-1.1.2-SNAPSHOT.jar"/>
-  <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcmail-jdk16/1.46/bcmail-jdk16-1.46.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar"/>
-  <classpathentry kind="var" path="M2_REPO/eu/eu-emi/security/canl/1.1.0/canl-1.1.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
-  <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.4/commons-io-1.4.jar"/>
-  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jglobus/gss/2.1-SNAPSHOT/gss-2.1-SNAPSHOT.jar" sourcepath="M2_REPO/org/jglobus/gss/2.1-SNAPSHOT/gss-2.1-SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/metastatic/rsync/JarSync/0.3/JarSync-0.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.6/jaxb-impl-2.1.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/xml/ws/jaxws-rt/2.1.3/jaxws-rt-2.1.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jglobus/jsse/2.1-SNAPSHOT/jsse-2.1-SNAPSHOT.jar" sourcepath="M2_REPO/org/jglobus/jsse/2.1-SNAPSHOT/jsse-2.1-SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
-  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
-  <classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jvnet/mimepull/1.1/mimepull-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/qcg/QCGCoreSDK/3.0.0/QCGCoreSDK-3.0.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/xml/messaging/saaj/saaj-impl/1.3/saaj-impl-1.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/xml/stream/sjsxp/1.0/sjsxp-1.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jglobus/ssl-proxies/2.1-SNAPSHOT/ssl-proxies-2.1-SNAPSHOT.jar" sourcepath="M2_REPO/org/jglobus/ssl-proxies/2.1-SNAPSHOT/ssl-proxies-2.1-SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jvnet/staxex/stax-ex/1.2/stax-ex-1.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/xml/stream/buffer/streambuffer/0.7/streambuffer-0.7.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/italiangrid/voms-api-java/3.0.0/voms-api-java-3.0.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/sun/org/apache/xml/security/xmlsec/2.0/xmlsec-2.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/qcg/endorsed/xws-security/CURRENT/xws-security-CURRENT.jar"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+	<classpathentry including="**/*.java" kind="src" path="target/jaxws/wsimport/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/xml/ws/jaxws-api/2.1/jaxws-api-2.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0/stax-api-1.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/xml/webservices-api/1.1.2-SNAPSHOT/webservices-api-1.1.2-SNAPSHOT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/cog-jglobus/CURRENT/cog-jglobus-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/cog-url/CURRENT/cog-url-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/cryptix/CURRENT/cryptix-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/cryptix-asn1/CURRENT/cryptix-asn1-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/cryptix32/CURRENT/cryptix32-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/metastatic/rsync/JarSync/0.3/JarSync-0.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.6/jaxb-impl-2.1.6.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/xml/ws/jaxws-rt/2.1.3/jaxws-rt-2.1.3.jar" sourcepath="/SOURCES/jaxws-ri-20070501/src"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/jce-jdk13-131/CURRENT/jce-jdk13-131-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/jgss/CURRENT/jgss-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
+	<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
+	<classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jvnet/mimepull/1.1/mimepull-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/puretls/CURRENT/puretls-CURRENT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/xml/messaging/saaj/saaj-impl/1.3/saaj-impl-1.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/xml/stream/sjsxp/1.0/sjsxp-1.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/qcg/QCGCoreSDK/2.1.0/QCGCoreSDK-2.1.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jvnet/staxex/stax-ex/1.2/stax-ex-1.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/xml/stream/buffer/streambuffer/0.7/streambuffer-0.7.jar"/>
+	<classpathentry kind="var" path="M2_REPO/com/sun/org/apache/xml/security/xmlsec/2.0/xmlsec-2.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/qcg/endorsed/xws-security/CURRENT/xws-security-CURRENT.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
 </classpath>
Index: trunk/java/WSIT/QCGComputingSDK/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/java/WSIT/QCGComputingSDK/.settings/org.eclipse.jdt.core.prefs	(revision 755)
+++ trunk/java/WSIT/QCGComputingSDK/.settings/org.eclipse.jdt.core.prefs	(revision 1)
@@ -1,3 +1,3 @@
-#Mon Jun 17 12:54:14 CEST 2013
+#Mon Aug 16 09:56:43 CEST 2010
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 eclipse.preferences.version=1
Index: trunk/java/WSIT/QCGReservationMonitor/README.txt
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/README.txt	(revision 93)
+++ trunk/java/WSIT/QCGReservationMonitor/README.txt	(revision 1)
@@ -2,4 +2,2 @@
 "qcg.polling.interval"
 "qcg.contact.string"
-
-
Index: trunk/java/WSIT/QCGReservationMonitor/.classpath
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/.classpath	(revision 326)
+++ trunk/java/WSIT/QCGReservationMonitor/.classpath	(revision 1)
@@ -1,44 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/activation-1.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/avalon-framework-4.1.3.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/cog-jglobus-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/cog-url-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/commons-logging-1.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/cryptix32-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/cryptix-asn1-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/cryptix-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/JarSync-0.3.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jaxb-api-2.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jaxb-impl-2.1.6.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jaxws-api-2.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jaxws-rt-2.1.3.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jce-jdk13-131-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jgss-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/jsr250-api-1.0.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/junit-3.8.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/log4j-1.2.12.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/logkit-1.0.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/mimepull-1.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/puretls-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/QCGComputingSDK-2.2.0.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/QCGCoreSDK-2.1.1.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/resolver-20050927.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/saaj-api-1.3.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/saaj-impl-1.3.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/servlet-api-2.3.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/sjsxp-1.0.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/stax-api-1.0.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/stax-ex-1.2.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/streambuffer-0.7.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/webservices-api-1.1.2-SNAPSHOT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/xmlsec-2.0.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/xws-security-CURRENT.jar"/>
-	<classpathentry kind="lib" path="D:/PCSS/QCGComputingSDK-2.2.0/lib/mysql-connector-java-5.1.17-bin.jar"/>
-	<classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcprov-jdk14/138/bcprov-jdk14-138.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/globus/cog-jglobus/cog-jglobus/1.4/cog-jglobus-1.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/cryptix/cryptix/wsrf/cryptix-wsrf.jar"/>
+  <classpathentry kind="var" path="M2_REPO/cryptix-asn1/cryptix-asn1/wsrf/cryptix-asn1-wsrf.jar"/>
+  <classpathentry kind="var" path="M2_REPO/cryptix32/cryptix32/wsrf/cryptix32-wsrf.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.6/jaxb-impl-2.1.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/xml/ws/jaxws-api/2.1/jaxws-api-2.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/xml/ws/jaxws-rt/2.1.3/jaxws-rt-2.1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jvnet/mimepull/1.1/mimepull-1.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/puretls/puretls/wsrf/puretls-wsrf.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/xml/messaging/saaj/saaj-impl/1.3/saaj-impl-1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/xml/stream/sjsxp/1.0/sjsxp-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/qcg/QCGComputingSDK/2.1/QCGComputingSDK-2.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/qcg/QCGCoreSDK/2.0/QCGCoreSDK-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0/stax-api-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jvnet/staxex/stax-ex/1.2/stax-ex-1.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/sun/xml/stream/buffer/streambuffer/0.7/streambuffer-0.7.jar"/>
 </classpath>
Index: trunk/java/WSIT/QCGReservationMonitor/clusters/colbud.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/clusters/colbud.properties	(revision 1)
+++ trunk/java/WSIT/QCGReservationMonitor/clusters/colbud.properties	(revision 1)
@@ -0,0 +1,5 @@
+cpu.count=4
+dsp.url=http://www.colbud.hu:2233/
+wrapper.path=/opt/QCG/ProActive3.9/scripts/unix/qcg_pa_wrapper.sh
+use.wsa=true
+proxy.map=192.168.42.61,192.168.42.62=www.colbud.hu:2234
Index: trunk/java/WSIT/QCGReservationMonitor/clusters/inria.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/clusters/inria.properties	(revision 1)
+++ trunk/java/WSIT/QCGReservationMonitor/clusters/inria.properties	(revision 1)
@@ -0,0 +1,5 @@
+cpu.count=10
+dsp.url=http://qcg.lri.fr:4051/
+wrapper.path=/opt/QCG/ProActive3.9/scripts/unix/qcg_pa_wrapper.sh
+use.wsa=true
+proxy.map=qcg1.lri.fr,qcg2.lri.fr,qcg3.lri.fr,qcg4.lri.fr,qcg.lri.fr=qcg.lri.fr:4096
Index: trunk/java/WSIT/QCGReservationMonitor/clusters/psnc.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/clusters/psnc.properties	(revision 1)
+++ trunk/java/WSIT/QCGReservationMonitor/clusters/psnc.properties	(revision 1)
@@ -0,0 +1,5 @@
+cpu.count=12
+dsp.url=http://node2.qoscosgrid.man.poznan.pl:5051/
+wrapper.path=/opt/QCG/ProActive3.9/scripts/unix/qcg_pa_wrapper.sh
+use.wsa=true
+proxy.map=node2.qoscosgrid.man.poznan.pl,node3.qoscosgrid.man.poznan.pl,node4.qoscosgrid.man.poznan.pl=node2.qoscosgrid.man.poznan.pl:5096
Index: trunk/java/WSIT/QCGReservationMonitor/clusters/psnc2.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/clusters/psnc2.properties	(revision 1)
+++ trunk/java/WSIT/QCGReservationMonitor/clusters/psnc2.properties	(revision 1)
@@ -0,0 +1,5 @@
+cpu.count=4
+dsp.url=http://alga1.man.poznan.pl:18101/
+wrapper.path=/opt/QCG/ProActive3.9/scripts/unix/qcg_pa_wrapper.sh
+use.wsa=true
+proxy.map=alga1.man.poznan.pl,alga2.man.poznan.pl=alga1.man.poznan.pl:18101
Index: trunk/java/WSIT/QCGReservationMonitor/clusters/uq.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/clusters/uq.properties	(revision 1)
+++ trunk/java/WSIT/QCGReservationMonitor/clusters/uq.properties	(revision 1)
@@ -0,0 +1,5 @@
+cpu.count=2
+dsp.url=http://balboa.imb.uq.edu.au:18001/
+wrapper.path=/opt/QCG/ProActive3.9/scripts/unix/qcg_pa_wrapper.sh
+use.wsa=true
+proxy.map=balboa.imb.uq.edu.au=balboa.imb.uq.edu.au:18001
Index: trunk/java/WSIT/QCGReservationMonitor/clusters/reefqcg.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/clusters/reefqcg.properties	(revision 94)
+++ 	(revision )
@@ -1,2 +1,0 @@
-dsp.url=httpg://qcg.reef.man.poznan.pl:19000/
-use.wsa=true
Index: trunk/java/WSIT/QCGReservationMonitor/src/main/java/pl/psnc/qcg/rm/Cluster.java
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/src/main/java/pl/psnc/qcg/rm/Cluster.java	(revision 94)
+++ trunk/java/WSIT/QCGReservationMonitor/src/main/java/pl/psnc/qcg/rm/Cluster.java	(revision 1)
@@ -3,6 +3,4 @@
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URI;
 import java.net.URL;
 import java.util.Properties;
@@ -10,8 +8,6 @@
 import javax.xml.bind.JAXBException;
 
-import org.qcg.comp.sdk.ARES;
-import org.qcg.comp.sdk.QCGFactory;
-import org.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
-import org.qcg.core.sdk.security.gsi.GSIAuthentication;
+import com.qcg.comp.sdk.ARES;
+import com.qcg.core.sdk.security.anonymous.AnonymousAuthentication;
 
 public class Cluster {
@@ -20,13 +16,10 @@
 
 	
-	protected URI dspUrl;
-	protected String pemURL;
+	protected URL dspUrl;
 	protected boolean useWSA;
 	protected ARES ares;
-	protected QCGFactory factory;
 	private String name;
 	
 	public Cluster(String propFile) throws JAXBException {
-		pemURL = System.getProperty("qcg.certificate.url");
 		name = new File(propFile).getName().split("\\.")[0];
 		Properties prop =  new Properties();
@@ -34,5 +27,5 @@
 			prop.load(new FileInputStream(propFile));
 			
-			dspUrl = new URI(prop.getProperty(DSP_ULR));
+			dspUrl = new URL(prop.getProperty(DSP_ULR));
 			useWSA = Boolean.parseBoolean(prop.getProperty(USE_WSA));
 		} catch (Exception e) {
@@ -41,25 +34,9 @@
 		
 		
-		//ares =  new ARES(dspUrl.getHost(), dspUrl.getPort(), new AnonymousAuthentication(), useWSA);
-		//factory = new QCGFactory(dspUrl.getHost(), dspUrl.getPort(), new AnonymousAuthentication(), useWSA);
-		GSIAuthentication gsi = null;
-		try {
-			gsi = new GSIAuthentication(pemURL, null);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
+		ares =  new ARES(dspUrl.getHost(), dspUrl.getPort(), new AnonymousAuthentication(), useWSA);
 		
-		ares =  new ARES(dspUrl.getHost(), dspUrl.getPort(), gsi, useWSA);
-		factory = new QCGFactory(dspUrl.getHost(), dspUrl.getPort(), gsi, useWSA);
-		
-		//factory.getFactoryAttributesDocument(false, true).getBasicResourceAttributesDocument();
 	}
 
-	public QCGFactory getFactory() {
-		return factory;
-	}
-
-	public URI getDspUrl() {
+	public URL getDspUrl() {
 		return dspUrl;
 	}
Index: trunk/java/WSIT/QCGReservationMonitor/src/main/java/pl/psnc/qcg/rm/QCGReservationMonitor.java
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/src/main/java/pl/psnc/qcg/rm/QCGReservationMonitor.java	(revision 326)
+++ trunk/java/WSIT/QCGReservationMonitor/src/main/java/pl/psnc/qcg/rm/QCGReservationMonitor.java	(revision 1)
@@ -1,29 +1,18 @@
 package pl.psnc.qcg.rm;
 
-import org.qcg.comp.sdk.exceptions.NotAuthorizedException;
-import org.qcg.comp.sdk.exceptions.UnknownReservationIdentifierException;
-import org.qcg.comp.sdk.types.ReservationDocument;
-import org.qcg.comp.sdk.types.ReservationEndpointReference;
-import org.qcg.comp.stubs.ares.ARESReservationStatusType;
-import org.qcg.comp.stubs.ares.ARESReservedHostType;
-import org.qcg.comp.stubs.bes.factory.BasicResourceAttributesDocumentType;
-import org.qcg.comp.stubs.bes.factory.FactoryResourceAttributesDocumentType;
-import org.qcg.comp.stubs.factory.GangliaHostType;
-import org.qcg.comp.stubs.factory.GangliaMetricType;
-import org.qcg.comp.stubs.factory.GangliaType;
-import org.qcg.comp.stubs.jsdl.CPUArchitectureType;
-import org.qcg.comp.stubs.monitoring.Host;
-import org.qcg.comp.stubs.monitoring.Job;
-import org.qcg.comp.stubs.monitoring.Reservation;
-import pl.psnc.qcg.rm.model.*;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import java.io.FileInputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.*;
-import java.util.*;
+
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.logging.Formatter;
 import java.util.logging.Level;
@@ -31,1389 +20,364 @@
 import java.util.logging.Logger;
 
-public class QCGReservationMonitor extends Thread {
-
-    private static Logger log = Logger.getLogger("RESMON");
-
-    static {
-        try {
-            // log.addHandler(new ConsoleHandler());
-            log.setLevel(Level.ALL);
-            log.getParent().getHandlers()[0].setFormatter(new Formatter() {
-
-                @Override
-                public String format(LogRecord record) {
-                    String tname = Thread.currentThread().getName();
-                    return "[" + String.format("%8s", tname) + "] - "
-                            + new Date(record.getMillis()) + " : "
-                            + record.getMessage() + "\n";
-                }
-            });
-
-        } catch (SecurityException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static final String QCG_PA_CLUSTERS = "qcg.clusters";
-    public static final String QCG_POLLING_INTERVAL = "qcg.polling.interval";
-    public static final String QCG_CONTACT_STRING = "qcg.contact.string";
-
-    public static final String INSERT_RES_INFO_SQL = "INSERT INTO reservations VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
-    public static final String INSERT_JOB_INFO_SQL = "INSERT INTO jobs VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ;";
-    public static final String INSERT_HOST_INFO_SQL = "INSERT INTO hosts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?, ?, ?, ?, ?, ?);";
-    public static final String INSERT_HOST_HISTORY_INFO_SQL = "INSERT INTO history_hosts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?, ?, ?, ? ,?, ?);";
-    public static final String UPDATE_HOST_INFO_SQL = "UPDATE hosts SET state = ?, attrs = ?, total_cpus = ?, reserved_cpus = ?, used_cpus = ?, utilization = ?, phys_mem = ?, virt_mem = ?, hptemp_ambient = ?, hptemp_memory_board = ?, hptemp_cpu01 = ?, hptemp_cpu02 = ?, hptemp_system_board = ?, history_timestamp = ?   WHERE host_id = ?;";
-    public static final String GET_HOST_ID_SQL = "SELECT host_id FORM hosts WHERE hostname = ?;";
-    public static final String DELETE_RES_INFO_SQL = "DELETE FROM reservations WHERE reservation_id = ?";
-    public static final String DELETE_RES_HOST_SQL = "DELETE FROM reservations_hosts WHERE reservation_id = ?";
-    public static final String UPDATE_RES_INFO_SQL = "UPDATE reservations SET start_time = ?, end_time = ? WHERE reservation_id = ?";
-    public static final String UPDATE_JOB_INFO_SQL = "UPDATE jobs SET start_time = ?, end_time = ?, est_start_time = ?, est_end_time = ?, cpu_usage = ? WHERE job_id = ?";
-    public static final String INSERT_RES_HOST_SQL = "INSERT INTO reservations_hosts VALUES (?, ?, ?);";
-    public static final String INSERT_JOB_HOST_SQL = "INSERT INTO jobs_hosts VALUES (?, ?, ?);";
-    public static final String DELETE_JOB_INFO_SQL = "DELETE FROM jobs WHERE job_id = ?";
-    public static final String DELETE_JOB_HOST_SQL = "DELETE FROM jobs_hosts WHERE job_id = ?;";
-    public static final String TEST_SQL = "SELECT * FROM reservations";
-    public static final String GET_HOSTS_SQL = "SELECT host_id, hostname, total_cpus, used_cpus FROM hosts WHERE cluster_name = ?";
-    public static final String DELETE_CURRENT_JOBS_SQL = "DELETE FROM jobs WHERE COALESCE(start_time, est_start_time) < ? AND COALESCE(end_time, est_end_time) > ? AND cluster_name = ?";
-    public static final String DELETE_CURRENT_RES_SQL = "DELETE FROM reservations WHERE start_time < ? AND end_time > ? AND cluster_name = ?";
-
-
-    public static final String[] TABLES = {"reservations",
-            "reservations_hosts", "jobs", "jobs_hosts", "hosts"};
-
-    public static final String TRUNCATE_ALL_TABLES_SQL = "TRUNCATE TABLE reservations; TRUNCATE TABLE reservations_hosts; TRUNCATE TABLE jobs; TRUNCATE TABLE jobs_hosts; TRUNCATE TABLE hosts;";
-    public static final String TRUNCATE_SQL = "TRUNCATE TABLE ";
-
-    public static final int DEFAULT_POLLING_INTERVAL = 60 * 1000;
-
-    public static final long MONTH_IN_MILLIS_VAL = 1000L * 60L * 60L * 24L
-            * 30L;
-
-    protected static int pollingInterval = DEFAULT_POLLING_INTERVAL;
-
-    protected Cluster cluster;
-    protected int clusterInterval = 4;
-    protected String contactString = System.getProperty(QCG_CONTACT_STRING);
-    protected Set<ReservationEndpointReference> activeReservations = new HashSet<ReservationEndpointReference>();
-    protected Set<ReservationEndpointReference> currentReservations = new HashSet<ReservationEndpointReference>();
-    protected Map<String, HostInfo> hostnames = new HashMap<String, HostInfo>();
-    protected Map<String, ResInfo> reservationDRMSIDMap = new HashMap<String, ResInfo>();
-    protected Map<String, JobInfo> jobIDMap = new HashMap<String, JobInfo>();
-    protected Map<ReservationEndpointReference, ResInfo> resTimeWindows = new HashMap<ReservationEndpointReference, ResInfo>();
-
-    protected Connection db;
-    protected PreparedStatement resAddStmt;
-    protected PreparedStatement resDelStmt;
-    protected PreparedStatement resUpdateStmt;
-    protected PreparedStatement hostStmt;
-    protected PreparedStatement testStmt;
-    protected PreparedStatement hostUpdtStmt;
-    protected PreparedStatement getHostIdStmt;
-    protected PreparedStatement insertResHostStmt;
-    protected PreparedStatement deleteResHostStmt;
-    protected PreparedStatement truncateAllStmt;
-    protected PreparedStatement jobAddStmt;
-    protected PreparedStatement insertJobHostStmt;
-    protected PreparedStatement deleteJobHostStmt;
-    protected PreparedStatement jobDelStmt;
-    protected PreparedStatement jobUpdateStmt;
-    protected PreparedStatement insertHostHistoryStmt;
-    protected PreparedStatement getHostsStmt;
-    protected PreparedStatement deleteCurrentJobsStmt;
-    protected PreparedStatement deleteCurrentResStmt;
-
-    /**
-     * @param args
-     * @throws JAXBException
-     */
-    public static void main(String[] args) throws Exception {
-
-        Class.forName("com.mysql.jdbc.Driver").newInstance();
-
-        FileInputStream propFile = new FileInputStream("config.properties");
-        Properties p = new Properties(System.getProperties());
-        p.load(propFile);
-
-        // set the system properties
-        System.setProperties(p);
-
-        pollingInterval = Integer.parseInt(System.getProperty(
-                QCG_POLLING_INTERVAL, DEFAULT_POLLING_INTERVAL + ""));
-
-        Grid grid = new Grid();
-
-        List<QCGReservationMonitor> monitorsList = new ArrayList<QCGReservationMonitor>();
-
-        for (Cluster c : grid.getClusters()) {
-            monitorsList.add(new QCGReservationMonitor(c));
-        }
-
-        for (QCGReservationMonitor m : monitorsList) {
-            m.start();
-        }
-
-        for (QCGReservationMonitor m : monitorsList) {
-            m.join();
-        }
-    }
-
-    public QCGReservationMonitor(Cluster cluster) throws JAXBException {
-        this.cluster = cluster;
-        setName(cluster.getName());
-    }
-
-    protected void createConnection() throws SQLException {
-        db = DriverManager.getConnection(contactString);
-        db.setAutoCommit(false);
-
-        resAddStmt = db.prepareStatement(INSERT_RES_INFO_SQL,
-                Statement.RETURN_GENERATED_KEYS);
-        resDelStmt = db.prepareStatement(DELETE_RES_INFO_SQL);
-        resUpdateStmt = db.prepareStatement(UPDATE_RES_INFO_SQL);
-        hostStmt = db.prepareStatement(INSERT_HOST_INFO_SQL,
-                Statement.RETURN_GENERATED_KEYS);
-        testStmt = db.prepareStatement(TEST_SQL);
-        hostUpdtStmt = db.prepareStatement(UPDATE_HOST_INFO_SQL);
-        getHostIdStmt = db.prepareStatement(GET_HOST_ID_SQL);
-        insertResHostStmt = db.prepareStatement(INSERT_RES_HOST_SQL);
-        // truncateAllStmt = db.prepareStatement(TRUNCATE_SQL);
-        insertJobHostStmt = db.prepareStatement(INSERT_JOB_HOST_SQL);
-        jobAddStmt = db.prepareStatement(INSERT_JOB_INFO_SQL,
-                Statement.RETURN_GENERATED_KEYS);
-        deleteResHostStmt = db.prepareStatement(DELETE_RES_HOST_SQL);
-        deleteJobHostStmt = db.prepareStatement(DELETE_JOB_HOST_SQL);
-        jobDelStmt = db.prepareStatement(DELETE_JOB_INFO_SQL);
-        jobUpdateStmt = db.prepareStatement(UPDATE_JOB_INFO_SQL);
-        insertHostHistoryStmt = db
-                .prepareStatement(INSERT_HOST_HISTORY_INFO_SQL, Statement.RETURN_GENERATED_KEYS);
-        getHostsStmt = db.prepareStatement(GET_HOSTS_SQL);
-        deleteCurrentJobsStmt = db.prepareStatement(DELETE_CURRENT_JOBS_SQL);
-        deleteCurrentResStmt = db.prepareStatement(DELETE_CURRENT_RES_SQL);
-
-    }
-
-    protected void releaseConnection() throws SQLException {
-        db.close();
-    }
-
-    protected boolean checkConnection() {
-        try {
-            testStmt.execute();
-            return true;
-        } catch (SQLException ex) {
-            log.severe("Test query failed: " + ex);
-        }
-
-        log.severe("Reconnecting..");
-
-        try {
-            resAddStmt.close();
-            resDelStmt.close();
-            resUpdateStmt.close();
-            testStmt.close();
-            db.close();
-        } catch (SQLException e) {
-            e.printStackTrace();
-        }
-
-        try {
-            createConnection();
-            return true;
-        } catch (SQLException ex) {
-            log.severe("Unable to create connection : " + ex);
-        }
-
-        return false;
-    }
-
-    private void clearAllTables() {
-
-        try {
-            for (String s : TABLES) {
-                truncateAllStmt = db.prepareStatement(TRUNCATE_SQL + s);
-
-                truncateAllStmt.executeUpdate();
-
-            }
-
-            db.commit();
-        } catch (SQLException e) {
-
-            log.info("cannot truncate tables " + e);
-            try {
-                db.rollback();
-            } catch (SQLException e1) {
-
-                log.info("cannot rollback " + e1);
-            }
-        }
-
-    }
-
-    private void loadHosts(String cluster) {
-
-        try {
-            getHostsStmt.setString(1, cluster);
-            getHostsStmt.execute();
-
-            ResultSet rs = getHostsStmt.getResultSet();
-
-            while (rs.next()) {
-                HostInfo h = new HostInfo();
-                h.setHostId(rs.getInt(1));
-                h.setHostName(rs.getString(2));
-                h.setTotalCPUs(rs.getInt(3));
-                h.setUsedCPUs(rs.getInt(4));
-
-                hostnames.put(h.getHostName(), h);
-            }
-
-        } catch (SQLException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-    }
-
-    private void clearCurrentResAndJobs(String cluster) {
-        Timestamp current = new Timestamp(new Date().getTime());
-
-        try {
-            deleteCurrentJobsStmt.setTimestamp(1, current);
-            deleteCurrentJobsStmt.setTimestamp(2, current);
-            deleteCurrentJobsStmt.setString(3, cluster);
-            deleteCurrentJobsStmt.executeUpdate();
-
-            deleteCurrentResStmt.setTimestamp(1, current);
-            deleteCurrentResStmt.setTimestamp(2, current);
-            deleteCurrentResStmt.setString(3, cluster);
-            deleteCurrentResStmt.executeUpdate();
-
-            db.commit();
-
-
-        } catch (SQLException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-
-    }
-
-    public void run() {
-        log.info("contact string = " + contactString);
-        log.info("polling interval = " + pollingInterval);
-
-        try {
-            createConnection();
-        } catch (SQLException ex) {
-            ex.printStackTrace();
-            return;
-        }
-
-        //clearAllTables();
-
-        loadHosts(cluster.getName().substring(0, 4));
-        clearCurrentResAndJobs(cluster.getName().substring(0, 4));
-
-        int clusterReadIterator = 0;
-
-        while (true) {
-            currentReservations.clear();
-
-            List<ReservationEndpointReference> reservations = null;
-
-            try {
-                log.info("reservation query");
-                reservations = cluster.getAres().getActiveReservations();
-            } catch (Exception ex) {
-                log.info("Unable to get reservation: " + ex);
-                sleep();
-                continue;
-            }
-
-            List<Object> attributesDocumentType = null;
-            GangliaType gangliaType = null;
-            if (clusterReadIterator == 0) {
-                try {
-                    attributesDocumentType = cluster.getFactory()
-                            .getFactoryAttributesDocument(false, true)
-                            .getContainedResource();
-                    gangliaType = cluster.getFactory().getFactoryAttributesDocument(false, true).getGanglia();
-                } catch (Exception ex) {
-                    log.info("FactoryAttributesDocument read failed(read hosts), " + ex);
-                    sleep();
-                    continue;
-                }
-
-                Map<String, HPTempInfo> temperatures = null;
-
-                if (gangliaType != null) {
-                    temperatures = new HashMap<String, HPTempInfo>();
-                    for (GangliaHostType host : gangliaType.getH()) {
-                        HPTempInfo tempInfo = new HPTempInfo();
-
-                        for (GangliaMetricType metric : host.getM()) {
-                            if (metric.getNm().equals("hptemp_ambient")) {
-                                tempInfo.setAmbient(Integer.parseInt(metric.getValue()));
-                            } else if (metric.getNm().equals("hptemp_system_board")) {
-                                tempInfo.setSystemBoard(Integer.parseInt(metric.getValue()));
-                            } else if (metric.getNm().equals("hptemp_memory_board")) {
-                                tempInfo.setMemoryBoard(Integer.parseInt(metric.getValue()));
-                            } else if (metric.getNm().equals("hptemp_cpu01")) {
-                                tempInfo.setCpu01(Integer.parseInt(metric.getValue()));
-                            } else if (metric.getNm().equals("hptemp_cpu02")) {
-                                tempInfo.setCpu02(Integer.parseInt(metric.getValue()));
-                            }
-                        }
-
-                        temperatures.put(host.getNm(), tempInfo);
-                    }
-                }
-
-                int orderNumber = 1;
-                Date current = new Date();
-                for (Object resource : attributesDocumentType) {
-
-                    HPTempInfo tempInfo = new HPTempInfo();
-                    if (temperatures != null) {
-                        tempInfo = temperatures.get(((BasicResourceAttributesDocumentType) resource).getResourceName());
-                        if (tempInfo == null) {
-                            tempInfo = new HPTempInfo();
-                        }
-                    }
-
-                    updateHostInfo(
-                            (BasicResourceAttributesDocumentType) resource,
-                            orderNumber, current, tempInfo);
-                    orderNumber++;
-                }
-            }
-
-            currentReservations.addAll(reservations);
-
-            for (ReservationEndpointReference rEpr : reservations) {
-                if (!activeReservations.contains(rEpr)) {
-                    addNewReservation(rEpr);
-                }
-            }
-
-            Set<ReservationEndpointReference> resToRemove = new HashSet<ReservationEndpointReference>();
-            for (ReservationEndpointReference rEpr : activeReservations) {
-                if (!currentReservations.contains(rEpr)) {
-
-                    log.info("reservation terminated: "
-                            + rEpr.getReservationUUID());
-                    resToRemove.add(rEpr);
-
-                }
-            }
-
-            activeReservations.removeAll(resToRemove);
-
-            Date currentTime = new Date();
-
-            resToRemove.clear();
-            // Delete/update reservation info
-            for (ReservationEndpointReference rEpr : resTimeWindows.keySet()) {
-                pl.psnc.qcg.rm.model.Info resInfo = resTimeWindows.get(rEpr);
-
-                if (resInfo.getEndTime().before(currentTime)) {
-                    resToRemove.add(rEpr);
-                    log.info("left unchanged (" + resInfo.getEndTime() + "<"
-                            + currentTime + "): " + rEpr.getReservationUUID());
-                    continue;
-                }
-
-                if (!activeReservations.contains(rEpr)) {
-                    resToRemove.add(rEpr);
-
-                    if (resInfo.getStartTime().after(currentTime)) {
-                        deleteReservation(rEpr);
-                    } else if (resInfo.getEndTime().after(currentTime)) {
-                        updateReservation(rEpr, resInfo.getStartTime(),
-                                currentTime);
-                    } else {
-                        log.info("left unchanged ???: "
-                                + rEpr.getReservationUUID());
-                    }
-
-                }
-            }
-
-            for (ReservationEndpointReference rEpr : resToRemove) {
-                resTimeWindows.remove(rEpr);
-            }
-
-            // reservations and jobs from cluster
-
-            if (clusterReadIterator == 0) {
-                List<Reservation> clusterReservations = null;
-                List<Job> clusterJobs = null;
-                try {
-                    FactoryResourceAttributesDocumentType factoryResourceAttributesDocumentType = cluster
-                            .getFactory().getFactoryAttributesDocument(false, true);
-
-                    clusterReservations = factoryResourceAttributesDocumentType
-                            .getClusterMonitoring().getReservations()
-                            .getReservation();
-
-                    clusterJobs = factoryResourceAttributesDocumentType
-                            .getClusterMonitoring().getJobs().getJob();
-                } catch (Exception ex) {
-                    log.info("Unable to obtain factory: " + ex);
-                    sleep();
-                    continue;
-                }
-
-                HashMap<String, Reservation> allReservations = new HashMap<String, Reservation>();
-
-                for (Reservation res : clusterReservations) {
-
-                    if (!reservationDRMSIDMap.containsKey(res.getName())) {
-                        addNewReservationFromCluster(res);
-                    } else {
-                        if (reservationDRMSIDMap.get(res.getName())
-                                .getResProvider() == ResInfo.CLUSTER_RESERVATION)
-                            updateReservationFromCluster(res);
-                    }
-
-                    allReservations.put(res.getName(), res);
-                }
-
-                Date current = new Date();
-
-                Map<String, ResInfo> tmpResMap = new HashMap<String, ResInfo>(
-                        reservationDRMSIDMap);
-
-                for (String drmsId : tmpResMap.keySet()) {
-                    if (!allReservations.containsKey(drmsId)) {
-                        ResInfo res = reservationDRMSIDMap.get(drmsId);
-                        if (res.getResProvider() == ResInfo.CLUSTER_RESERVATION) {
-                            if (checkExistInFuture(current, res))
-                                deleteReservationFromCluster(res);
-                            else
-                                reservationDRMSIDMap.remove(drmsId);
-                        }
-                    }
-                }
-
-                HashMap<String, Job> allJobs = new HashMap<String, Job>();
-
-                for (Job job : clusterJobs) {
-
-                    if (!jobIDMap.containsKey(job.getId())) {
-                        if (job.getHost() != null && !job.getHost().isEmpty())
-                            addNewJobFromCluster(job);
-                    } else {
-                        updateJobFromCluster(job);
-                    }
-
-                    allJobs.put(job.getId(), job);
-                }
-
-                Map<String, JobInfo> tmpJobMap = new HashMap<String, JobInfo>(
-                        jobIDMap);
-
-                for (String drmsId : tmpJobMap.keySet()) {
-                    if (!allJobs.containsKey(drmsId)) {
-                        JobInfo job = jobIDMap.get(drmsId);
-                        if (checkExistInFuture(current, job))
-                            deleteJobFromCluster(job);
-                        else
-                            jobIDMap.remove(drmsId);
-                    }
-                }
-
-            }
-            clusterReadIterator++;
-            clusterReadIterator = clusterReadIterator % clusterInterval;
-
-            //reload sql connection
-            try {
-                releaseConnection();
-
-                createConnection();
-
-            } catch (SQLException e) {
-                e.printStackTrace();
-            }
-
-
-            sleep();
-        }
-
-    }
-
-    private boolean checkExistInFuture(Date current, Info info) {
-
-        if (info.getStartTime() != null)
-            if (current.before(info.getStartTime()))
-                return true;
-        return false;
-
-    }
-
-    private void deleteJobFromCluster(JobInfo jobInfo) {
-
-        log.info("deleting cluster job :" + jobInfo.getJobId());
-
-        try {
-            jobDelStmt.setInt(1, jobInfo.getJobKeyId());
-            jobDelStmt.executeUpdate();
-
-            deleteJobHostStmt.setInt(1, jobInfo.getJobKeyId());
-            deleteJobHostStmt.executeUpdate();
-
-            db.commit();
-
-            jobIDMap.remove(jobInfo.getJobId());
-
-        } catch (SQLException e) {
-            log.info("cannot delete job: " + jobInfo.getJobId() + " " + e);
-
-            try {
-                db.rollback();
-            } catch (SQLException e1) {
-                log.info("cannot rollback delete job: " + jobInfo.getJobId()
-                        + " " + e);
-            }
-        }
-
-    }
-
-    private void updateJobFromCluster(Job job) {
-
-        JobInfo jobInfo = jobIDMap.get(job.getId());
-
-        /*try {
-              deleteJobHostStmt.setInt(1, jobInfo.getJobKeyId());
-              deleteJobHostStmt.executeUpdate();
-
-              for (Host h : job.getHost()) {
-
-                  if (hostnames.containsKey(h.getName())) {
-
-                      insertJobHostStmt.setInt(1, jobInfo.getJobKeyId());
-                      insertJobHostStmt.setInt(2, hostnames.get(h.getName())
-                              .getHostId());
-
-                      insertJobHostStmt.setInt(3, hostnames.get(h.getName())
-                              .getTotalCPUs());
-
-                      insertJobHostStmt.executeUpdate();
-                  }
-
-              }
-
-              db.commit();
-
-          } catch (SQLException e1) {
-              // TODO Auto-generated catch block
-              e1.printStackTrace();
-          }*/
-
-        Timestamp start = null;
-        Timestamp end = null;
-
-        if (job.getStartTime() == null && job.getEstEndTime() != null)
-            start = new Timestamp(job.getEstStartTime().toGregorianCalendar()
-                    .getTime().getTime());
-        else if (job.getStartTime() != null)
-            start = new Timestamp(job.getStartTime().toGregorianCalendar()
-                    .getTime().getTime());
-
-        if (job.getEndTime() == null && job.getEstEndTime() != null)
-            end = new Timestamp(job.getEstEndTime().toGregorianCalendar()
-                    .getTime().getTime());
-        else if (job.getEndTime() != null)
-            end = new Timestamp(job.getEndTime().toGregorianCalendar()
-                    .getTime().getTime());
-
-        if (end == null && start != null) {
-            end = new Timestamp(((Timestamp) start.clone()).getTime());
-            end.setYear(end.getYear() + 1);
-        }
-
-        if (start != null && end != null && jobInfo.getStartTime() != null
-                && jobInfo.getEndTime() != null) {
-            if (jobInfo.getStartTime().getTime() == start.getTime())
-                if (jobInfo.getEndTime().getTime() == end.getTime())
-                    return;
-        }
-
-
-        log.info("updating cluster job : " + job.getId());
-
-        try {
-            if (job.getStartTime() == null)
-
-                jobUpdateStmt.setNull(1, Types.TIMESTAMP);
-
-            else
-                jobUpdateStmt.setTimestamp(1, new Timestamp(job.getStartTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-            if (job.getEndTime() == null)
-                jobUpdateStmt.setNull(2, Types.TIMESTAMP);
-            else
-                jobUpdateStmt.setTimestamp(2, new Timestamp(job.getEndTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-            if (job.getEstStartTime() == null)
-                jobUpdateStmt.setNull(3, Types.TIMESTAMP);
-            else
-                jobUpdateStmt.setTimestamp(3, new Timestamp(job
-                        .getEstStartTime().toGregorianCalendar().getTime()
-                        .getTime()));
-
-            if (job.getEstEndTime() == null)
-                jobUpdateStmt.setNull(4, Types.TIMESTAMP);
-            else
-                jobUpdateStmt.setTimestamp(4, new Timestamp(job.getEstEndTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-            if (job.getEndTime() == null && job.getEstEndTime() == null && start != null) {
-                end = new Timestamp(((Timestamp) start.clone()).getTime());
-                end.setYear(end.getYear() + 1);
-                jobAddStmt.setTimestamp(4, end);
-            }
-
-            if (job.getCpuTime() != null)
-                jobUpdateStmt.setString(5, job.getCpuTime());
-            else
-                jobUpdateStmt.setNull(5, Types.VARCHAR);
-
-            jobUpdateStmt.setInt(6, jobIDMap.get(job.getId()).getJobKeyId());
-
-            jobUpdateStmt.executeUpdate();
-
-            db.commit();
-
-            jobInfo.setStartTime(start);
-            jobInfo.setEndTime(end);
-
-        } catch (SQLException e) {
-            log.info("cannot update job: " + job.getId() + " " + e);
-
-            try {
-                db.rollback();
-            } catch (SQLException e1) {
-                log.info("cannot rollback update job: " + job.getId() + " " + e);
-            }
-        }
-
-    }
-
-    private void deleteReservationFromCluster(ResInfo resInfo) {
-        log.info("deleting cluster reservation : " + resInfo.getDrmsId());
-
-        try {
-            resDelStmt.setInt(1, resInfo.getReservationId());
-            resDelStmt.executeUpdate();
-
-            deleteResHostStmt.setInt(1, resInfo.getReservationId());
-            deleteResHostStmt.executeUpdate();
-
-            db.commit();
-
-            reservationDRMSIDMap.remove(resInfo.getDrmsId());
-        } catch (SQLException ex) {
-
-            log.info("cannot delete cluster reservation: "
-                    + resInfo.getDrmsId() + " " + ex);
-
-            try {
-                db.rollback();
-            } catch (SQLException e) {
-                log.info("cannot rollback delete cluster reservation: "
-                        + resInfo.getDrmsId() + " " + e);
-            }
-        }
-
-    }
-
-    private void updateReservationFromCluster(Reservation res) {
-
-        ResInfo resInfo = reservationDRMSIDMap.get(res.getName());
-
-        /*try {
-              deleteResHostStmt.setInt(1, resInfo.getReservationId());
-              deleteResHostStmt.executeUpdate();
-
-              for (Host h : res.getHost()) {
-
-                  if (hostnames.containsKey(h.getName())) {
-
-                      insertResHostStmt.setInt(1, resInfo.getReservationId());
-                      insertResHostStmt.setInt(2, hostnames.get(h.getName())
-                              .getHostId());
-
-                      insertResHostStmt.setInt(3, hostnames.get(h.getName())
-                              .getTotalCPUs());
-
-                      insertResHostStmt.executeUpdate();
-                  }
-
-              }
-              db.commit();
-
-          } catch (SQLException e1) {
-              // TODO Auto-generated catch block
-              e1.printStackTrace();
-          }*/
-
-        Date start, end;
-
-        if (res.getEndTime() == null)
-            return;
-
-        start = res.getStartTime().toGregorianCalendar().getTime();
-        end = res.getEndTime().toGregorianCalendar().getTime();
-
-        if (start.equals(resInfo.getStartTime()))
-            if (end.equals(resInfo.getEndTime()))
-                return;
-
-        log.info("updating cluster reservation : " + res.getName());
-
-        try {
-
-            if ((end.getTime() - start.getTime()) > 3 * MONTH_IN_MILLIS_VAL) {
-                // end.setTime(start.getTime() + MONTH_IN_MILLIS_VAL * 3);
-            }
-
-            resUpdateStmt.setTimestamp(1, new Timestamp(start.getTime()));
-            resUpdateStmt.setTimestamp(2, new Timestamp(end.getTime()));
-            resUpdateStmt.setInt(3, resInfo.getReservationId());
-            resUpdateStmt.executeUpdate();
-            db.commit();
-
-            resInfo.setStartTime(start);
-            resInfo.setEndTime(end);
-
-        } catch (SQLException ex) {
-
-            log.info("cannot update cluster reservation: "
-                    + resInfo.getDrmsId() + " " + ex);
-
-            try {
-                db.rollback();
-            } catch (SQLException e) {
-                log.info("cannot rollback update cluster reservation: "
-                        + resInfo.getDrmsId() + " " + e);
-            }
-        }
-
-    }
-
-    private void addNewJobFromCluster(Job job) {
-
-        try {
-
-            jobAddStmt.setNull(1, Types.INTEGER);
-            jobAddStmt.setString(2, cluster.getName().substring(0, 4));
-            jobAddStmt.setString(3, job.getId());
-            jobAddStmt.setString(4, job.getName());
-            jobAddStmt.setString(5, job.getQueue());
-
-            if (job.getResId() != null) {
-                if (reservationDRMSIDMap.containsKey(job.getResId()))
-                    jobAddStmt.setInt(6,
-                            reservationDRMSIDMap.get(job.getResId())
-                                    .getReservationId());
-                else
-                    jobAddStmt.setNull(6, Types.INTEGER);
-            } else {
-                jobAddStmt.setNull(6, Types.INTEGER);
-            }
-            Timestamp start = null;
-            jobAddStmt.setString(7, job.getOwner());
-            jobAddStmt.setTimestamp(8, new Timestamp(job.getSubmissionTime()
-                    .toGregorianCalendar().getTime().getTime()));
-            if (job.getStartTime() == null)
-                jobAddStmt.setNull(9, Types.TIMESTAMP);
-            else
-                jobAddStmt.setTimestamp(9, start = new Timestamp(job.getStartTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-
-            if (job.getEndTime() == null)
-                jobAddStmt.setNull(10, Types.TIMESTAMP);
-            else
-                jobAddStmt.setTimestamp(10, new Timestamp(job.getEndTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-            if (job.getEstStartTime() == null)
-                jobAddStmt.setNull(11, Types.TIMESTAMP);
-            else
-                jobAddStmt.setTimestamp(11, start = new Timestamp(job.getEstStartTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-            if (job.getEstEndTime() == null)
-                jobAddStmt.setNull(12, Types.TIMESTAMP);
-            else
-                jobAddStmt.setTimestamp(12, new Timestamp(job.getEstEndTime()
-                        .toGregorianCalendar().getTime().getTime()));
-
-            if (job.getEndTime() == null && job.getEstEndTime() == null && start != null) {
-                Timestamp end = new Timestamp(((Timestamp) start.clone()).getTime());
-                end.setYear(end.getYear() + 1);
-                jobAddStmt.setTimestamp(12, end);
-            }
-
-            if (job.getCpuTime() != null)
-                jobAddStmt.setString(13, job.getCpuTime());
-            else
-                jobAddStmt.setNull(13, Types.VARCHAR);
-
-            if (job.getMemUsage() != null) {
-                String mem = job.getMemUsage().replaceAll("[A-Za-z]*", "");
-
-                jobAddStmt.setBigDecimal(14,
-                        new BigDecimal(new BigInteger(mem)));
-            } else
-                jobAddStmt.setNull(14, Types.BIGINT);
-
-            if (job.getDesc() != null)
-                jobAddStmt.setString(
-                        15,
-                        job.getDesc().substring(0,
-                                Math.min(32, job.getDesc().length())));
-            else
-                jobAddStmt.setNull(15, Types.VARCHAR);
-
-            jobAddStmt.executeUpdate();
-
-            ResultSet rs = jobAddStmt.getGeneratedKeys();
-            int key;
-
-            rs.next();
-
-            key = rs.getInt(1);
-
-            for (Host h : job.getHost()) {
-
-                if (hostnames.containsKey(h.getName())) {
-
-                    insertJobHostStmt.setInt(1, key);
-                    insertJobHostStmt.setInt(2, hostnames.get(h.getName())
-                            .getHostId());
-
-                    if (h.getSlots() == null)
-                        insertJobHostStmt.setInt(3, hostnames.get(h.getName())
-                                .getTotalCPUs());
-                    else
-                        insertJobHostStmt.setInt(3, h.getSlots().intValue());
-
-                    insertJobHostStmt.executeUpdate();
-                }
-
-            }
-
-            db.commit();
-
-            start = null;
-            Timestamp end = null;
-
-            if (job.getStartTime() == null && job.getEstEndTime() != null)
-                start = new Timestamp(job.getEstStartTime()
-                        .toGregorianCalendar().getTime().getTime());
-            else if (job.getStartTime() != null)
-                start = new Timestamp(job.getStartTime().toGregorianCalendar()
-                        .getTime().getTime());
-
-            if (job.getEndTime() == null && job.getEstEndTime() != null)
-                end = new Timestamp(job.getEstEndTime().toGregorianCalendar()
-                        .getTime().getTime());
-            else if (job.getEndTime() != null)
-                end = new Timestamp(job.getEndTime().toGregorianCalendar()
-                        .getTime().getTime());
-
-            JobInfo jobInfo = new JobInfo(start, end);
-
-            jobInfo.setJobId(job.getId());
-            jobInfo.setDrmsId(job.getId());
-            jobInfo.setJobKeyId(key);
-
-            jobIDMap.put(job.getId(), jobInfo);
-
-            // log.info("new job added: " + job.getId());
-
-        } catch (SQLException e) {
-
-            log.info(" cannot add job: " + job.getId() + " " + e);
-
-            try {
-                db.rollback();
-            } catch (SQLException e1) {
-                // TODO Auto-generated catch block
-                log.info(" cannot rollback add job " + job.getId() + " " + e);
-            }
-        }
-
-    }
-
-    private void sleep() {
-        try {
-            Thread.sleep(pollingInterval);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private void sleepMillis(long pollingInterval) {
-        try {
-            Thread.sleep(pollingInterval);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private void deleteReservation(ReservationEndpointReference epr) {
-        log.info("deleting reservation :" + epr.getReservationUUID());
-
-        ResInfo resInfo;
-
-        try {
-            resInfo = reservationDRMSIDMap.get(cluster.getAres()
-                    .getReservationDocument(epr).getLocalReservationId());
-        } catch (NotAuthorizedException e) {
-
-            log.info("not authorized: " + e);
-
-            return;
-        } catch (UnknownReservationIdentifierException e) {
-
-            log.info("unknown reservation: " + e);
-
-            return;
-        }
-
-        try {
-            resDelStmt.setInt(1, resInfo.getReservationId());
-            resDelStmt.executeUpdate();
-
-            deleteResHostStmt.setInt(1, resInfo.getReservationId());
-            deleteResHostStmt.executeUpdate();
-
-            db.commit();
-
-            reservationDRMSIDMap.remove(resInfo.getDrmsId());
-
-        } catch (SQLException ex) {
-
-            ex.printStackTrace();
-
-            try {
-                db.rollback();
-            } catch (SQLException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private void updateReservation(ReservationEndpointReference epr,
-                                   Date startTime, Date endTime) {
-        log.info("updating reservation EPR :" + epr.getReservationUUID()
-                + " -> " + endTime);
-
-        ResInfo resInfo = null;
-        ReservationDocument resDoc = null;
-        ARESReservationStatusType resStat = null;
-
-        try {
-            resInfo = reservationDRMSIDMap.get(cluster.getAres()
-                    .getReservationDocument(epr).getLocalReservationId());
-
-            // resDoc = cluster.getAres().getReservationDocument(epr);
-            /*resStat = cluster.getAres().getReservationStatus(epr);
-
-               deleteResHostStmt.setInt(1, resInfo.getReservationId());
-               deleteResHostStmt.executeUpdate();
-
-               for (ARESReservedHostType rh : resStat.getReservedHost()) {
-
-                   if (hostnames.containsKey(rh.getHostName())) {
-                       insertResHostStmt.setInt(1, resInfo.getReservationId());
-                       insertResHostStmt.setInt(2, hostnames.get(rh.getHostName())
-                               .getHostId());
-                       insertResHostStmt.setInt(3, rh.getReservedSlotsCount()
-                               .intValue());
-
-                       insertResHostStmt.executeUpdate();
-
-                   }
-
-               }
-
-               db.commit();
-                */
-        } catch (NotAuthorizedException e) {
-
-            log.info("not authorized: " + e);
-
-            return;
-        } catch (UnknownReservationIdentifierException e) {
-
-            log.info("unknown reservation: " + e);
-
-            return;
-        }
-
-
-        try {
-
-            if ((endTime.getTime() - startTime.getTime()) > MONTH_IN_MILLIS_VAL * 3) {
-                // endTime.setTime(startTime.getTime() + MONTH_IN_MILLIS_VAL *
-                // 3);
-            }
-
-            resUpdateStmt.setTimestamp(1, new Timestamp(startTime.getTime()));
-            resUpdateStmt.setTimestamp(2, new Timestamp(endTime.getTime()));
-            resUpdateStmt.setInt(3, resInfo.getReservationId());
-            resUpdateStmt.executeUpdate();
-            db.commit();
-        } catch (SQLException ex) {
-
-            ex.printStackTrace();
-
-            try {
-                db.rollback();
-            } catch (SQLException e) {
-                e.printStackTrace();
-            }
-        }
-
-    }
-
-    private void addNewReservationFromCluster(Reservation reservation) {
-
-        try {
-            Timestamp start;
-            Timestamp end;
-
-            resAddStmt.setNull(1, java.sql.Types.INTEGER);
-            resAddStmt.setString(2, cluster.getName().substring(0, 4));
-            resAddStmt.setString(3, reservation.getName());
-            resAddStmt.setString(4, reservation.getName());
-            resAddStmt.setTimestamp(5, start = new Timestamp(reservation
-                    .getStartTime().toGregorianCalendar().getTime().getTime()));
-
-            if (reservation.getEndTime() == null) {
-                end = new Timestamp(((Timestamp) start.clone()).getTime());
-                end.setYear(end.getYear() + 1);
-            } else {
-                end = new Timestamp(reservation.getEndTime()
-                        .toGregorianCalendar().getTime().getTime());
-
-                if ((end.getTime() - start.getTime()) > 3 * MONTH_IN_MILLIS_VAL) {
-                    // end.setTime(start.getTime() + MONTH_IN_MILLIS_VAL * 3);
-                }
-            }
-
-            resAddStmt.setTimestamp(6, end);
-
-            String name = reservation.getName();
-            if (reservation.getName().indexOf(".") != -1)
-                name = name.substring(0, reservation.getName().indexOf("."));
-
-            resAddStmt.setString(7, name);
-            resAddStmt.setString(8, reservation.getType());
-            resAddStmt.executeUpdate();
-
-            ResultSet rs = resAddStmt.getGeneratedKeys();
-            int key;
-
-            rs.next();
-
-            key = rs.getInt(1);
-
-            for (Host h : reservation.getHost()) {
-
-                if (hostnames.containsKey(h.getName())) {
-
-                    insertResHostStmt.setInt(1, key);
-                    insertResHostStmt.setInt(2, hostnames.get(h.getName())
-                            .getHostId());
-
-                    // if (h.getSlots() == null)
-                    insertResHostStmt.setInt(3, hostnames.get(h.getName())
-                            .getTotalCPUs());
-                    // else
-                    // insertResHostStmt.setInt(3, h.getSlots().intValue());
-
-                    insertResHostStmt.executeUpdate();
-                }
-
-            }
-
-            ResInfo resInfo = new ResInfo(start, end);
-            resInfo.setDrmsId(reservation.getName());
-            resInfo.setReservationId(key);
-            resInfo.setResProvider(ResInfo.CLUSTER_RESERVATION);
-            reservationDRMSIDMap.put(reservation.getName(), resInfo);
-
-        } catch (SQLException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-    }
-
-    private void addNewReservation(ReservationEndpointReference epr) {
-        ReservationDocument resDoc = null;
-        ARESReservationStatusType resStat = null;
-
-        log.info("adding new reservation:" + epr.getReservationUUID());
-
-        try {
-            resDoc = cluster.getAres().getReservationDocument(epr);
-            resStat = cluster.getAres().getReservationStatus(epr);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-            log.info("unable to get reservation stat/doc: " + ex);
-            return;
-        }
-
-        String uuid = epr.getReservationUUID();
-        String drmsId = resDoc.getLocalReservationId();
-        String name = resDoc.getArdl().getName();
-
-        // rational: second step of QCG algorithm
-        if (name != null) {
-            name = name.split(":")[0];
-        }
-
-        String username = resDoc.getArdl().getUserName();
-        Date startTime = resDoc.getArdl().getStartTime();
-        Date endTime = resDoc.getArdl().getEndTime();
-        String description = resDoc.getArdl().getDescription();
-
-        try {
-            resAddStmt.setNull(1, java.sql.Types.INTEGER);
-            resAddStmt.setString(2, cluster.getName().substring(0, 4));
-            resAddStmt.setString(3, drmsId);
-            resAddStmt.setString(4, name);
-
-            if ((endTime.getTime() - startTime.getTime()) > MONTH_IN_MILLIS_VAL * 3) {
-                // endTime.setTime(startTime.getTime() + MONTH_IN_MILLIS_VAL *
-                // 3);
-            }
-            resAddStmt.setTimestamp(5, new Timestamp(startTime.getTime()));
-            resAddStmt.setTimestamp(6, new Timestamp(endTime.getTime()));
-            resAddStmt.setString(7, username);
-            resAddStmt.setString(8, description);
-            resAddStmt.executeUpdate();
-
-            ResultSet rs = resAddStmt.getGeneratedKeys();
-            int key;
-
-            rs.next();
-
-            key = rs.getInt(1);
-
-            for (ARESReservedHostType rh : resStat.getReservedHost()) {
-
-                if (hostnames.containsKey(rh.getHostName())) {
-                    insertResHostStmt.setInt(1, key);
-                    insertResHostStmt.setInt(2, hostnames.get(rh.getHostName())
-                            .getHostId());
-                    insertResHostStmt.setInt(3, rh.getReservedSlotsCount()
-                            .intValue());
-
-                    insertResHostStmt.executeUpdate();
-
-                }
-
-            }
-
-            db.commit();
-            activeReservations.add(epr);
-
-            ResInfo resInfo = new ResInfo(resDoc.getArdl().getStartTime(),
-                    resDoc.getArdl().getEndTime());
-            resInfo.setDrmsId(drmsId);
-            resInfo.setReservationId(key);
-            resInfo.setResProvider(ResInfo.QCG_RESERVATION);
-            reservationDRMSIDMap.put(drmsId, resInfo);
-            resTimeWindows.put(epr, resInfo);
-
-        } catch (SQLException ex) {
-            if (ex instanceof com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException) {
-                activeReservations.add(epr);
-                resTimeWindows.put(epr, new ResInfo(resDoc.getArdl()
-                        .getStartTime(), resDoc.getArdl().getEndTime()));
-
-            }
-
-            log.info("unable to insert new row: " + ex);
-            try {
-                db.rollback();
-            } catch (SQLException e) {
-                log.info("unable to rollback: " + e);
-            }
-        }
-
-    }
-
-    private void updateHostInfo(BasicResourceAttributesDocumentType resource,
-                                int orderNumber, Date stamp, HPTempInfo tempInfo) {
-        // log.info("ostname: " + resource.getResourceName());
-        if (hostnames.containsKey(resource.getResourceName())) {
-
-            try {
-                hostUpdtStmt.setString(
-                        1,
-                        getValueOfQName(new String(), "State",
-                                resource.getAny()));
-                hostUpdtStmt.setString(
-                        2,
-                        getValueOfQName(new String(), "Attributes",
-                                resource.getAny()));
-                hostUpdtStmt.setInt(3, (int) resource.getCPUCount().intValue());
-                hostUpdtStmt.setInt(4, 0);
-                hostUpdtStmt.setInt(
-                        5,
-                        (getValueOfQName(new BigInteger("0"), "UsedCPUCount",
-                                resource.getAny())).intValue());
-                hostUpdtStmt.setInt(
-                        6,
-                        (getValueOfQName(new Double(0), "Utilization",
-                                resource.getAny())).intValue());
-                hostUpdtStmt.setInt(7,
-                        preventNullCPUCount(resource.getPhysicalMemory()));
-                hostUpdtStmt.setInt(8,
-                        preventNullCPUCount(resource.getVirtualMemory()));
-
-                hostUpdtStmt.setInt(9, tempInfo.getAmbient());
-                hostUpdtStmt.setInt(10, tempInfo.getMemoryBoard());
-                hostUpdtStmt.setInt(11, tempInfo.getCpu01());
-                hostUpdtStmt.setInt(12, tempInfo.getCpu02());
-                hostUpdtStmt.setInt(13, tempInfo.getSystemBoard());
-                hostUpdtStmt.setTimestamp(14, new Timestamp(stamp.getTime()));
-                hostUpdtStmt.setInt(15, hostnames
-                        .get(resource.getResourceName()).getHostId());
-                hostUpdtStmt.executeUpdate();
-
-                db.commit();
-
-            } catch (SQLException e) { // TODO Auto-generated catch block
-                log.info("unable to update host info: " + e);
-            }
-
-            addHost(resource, orderNumber, stamp, tempInfo, false, insertHostHistoryStmt);
-
-        } else {
-
-            addHost(resource, orderNumber, stamp, tempInfo, true, hostStmt);
-            addHost(resource, orderNumber, stamp, tempInfo, false, insertHostHistoryStmt);
-
-        }
-
-    }
-
-    private void addHost(BasicResourceAttributesDocumentType resource,
-                         int orderNumber, Date stamp, HPTempInfo tempInfo, boolean put, PreparedStatement hostStmt) {
-
-        try {
-            int usedCPUs;
-
-            hostStmt.setNull(1, java.sql.Types.INTEGER);
-            hostStmt.setString(2, cluster.getName().substring(0, 4));
-            hostStmt.setString(3, resource.getResourceName());
-            hostStmt.setString(4,
-                    getValueOfQName(new String(), "State", resource.getAny()));
-            hostStmt.setString(
-                    5,
-                    getValueOfQName(new String(), "Attributes",
-                            resource.getAny()));
-            hostStmt.setInt(6, (int) resource.getCPUCount().intValue());
-            hostStmt.setInt(7, 0);
-            hostStmt.setInt(
-                    8,
-                    (usedCPUs = (getValueOfQName(new BigInteger("0"),
-                            "UsedCPUCount", resource.getAny())).intValue()));
-            hostStmt.setInt(
-                    9,
-                    (getValueOfQName(new Double(0), "Utilization",
-                            resource.getAny())).intValue());
-            hostStmt.setString(10,
-                    preventNullCpuArchitecture(resource.getCPUArchitecture()));
-            hostStmt.setInt(11,
-                    preventNullCPUCount(resource.getPhysicalMemory()));
-            hostStmt.setInt(12,
-                    preventNullCPUCount(resource.getVirtualMemory()));
-            hostStmt.setInt(13, orderNumber);
-            hostStmt.setTimestamp(14, new Timestamp(stamp.getTime()));
-
-            hostStmt.setInt(15, tempInfo.getAmbient());
-            hostStmt.setInt(16, tempInfo.getMemoryBoard());
-            hostStmt.setInt(17, tempInfo.getCpu01());
-            hostStmt.setInt(18, tempInfo.getCpu02());
-            hostStmt.setInt(19, tempInfo.getSystemBoard());
-
-            hostStmt.executeUpdate();
-
-            ResultSet rs = hostStmt.getGeneratedKeys();
-            int key;
-
-            rs.next();
-
-            key = rs.getInt(1);
-
-            db.commit();
-
-            if (put)
-                hostnames.put(resource.getResourceName(), new HostInfo(key,
-                        resource.getResourceName(), resource.getCPUCount()
-                        .intValue(), usedCPUs));
-
-        } catch (SQLException e) {
-            // TODO Auto-generated catch block
-            log.info("unable to insert host info: " + e);
-        }
-
-    }
-
-    private String preventNullCpuArchitecture(CPUArchitectureType cat) {
-        String returnString = "not available";
-        if (cat != null)
-            if (cat.getCPUArchitectureName() != null)
-                if (cat.getCPUArchitectureName().value() != null)
-                    returnString = cat.getCPUArchitectureName().value();
-
-        return returnString;
-    }
-
-    private int preventNullCPUCount(Double d) {
-        int value = 0;
-
-        if (d != null)
-            value = d.intValue();
-
-        return value;
-
-    }
-
-    private <T> T getValueOfQName(T returnType, String qName,
-                                  List<Object> jaxbElementList) {
-        T obj = null;
-
-        for (Object o : jaxbElementList) {
-
-            if (((JAXBElement) o).getName().getLocalPart().equals(qName)) {
-                obj = (T) ((JAXBElement) o).getValue();
-                break;
-            }
-
-        }
-
-        if (obj == null) {
-            obj = returnType;
-        }
-
-        return obj;
-    }
+import javax.xml.bind.JAXBException;
+
+import com.qcg.comp.sdk.types.ReservationDocument;
+import com.qcg.comp.sdk.types.ReservationEndpointReference;
+import com.qcg.comp.stubs.ares.ARESReservationStatusType;
+import com.qcg.comp.stubs.ares.ARESReservedHostType;
+
+
+public class QCGReservationMonitor extends Thread{
+
+	private static Logger log = Logger.getLogger("RESMON");
+	
+	static {
+		try {
+			//log.addHandler(new ConsoleHandler());
+			log.setLevel(Level.ALL);
+			log.getParent().getHandlers()[0].setFormatter(new Formatter() {
+
+				@Override
+				public String format(LogRecord record) {
+					String tname = Thread.currentThread().getName();
+					return "[" + String.format("%8s", tname) + "] - " + new Date(record.getMillis()) + " : " + record.getMessage() + "\n";
+				}
+			});
+			
+			
+		} catch (SecurityException e) {
+			e.printStackTrace();
+		}
+	}
+	public static final String QCG_PA_CLUSTERS = "qcg.clusters";
+	public static final String QCG_POLLING_INTERVAL = "qcg.polling.interval";
+	public static final String QCG_CONTACT_STRING = "qcg.contact.string";
+	
+	public static final String INSERT_RES_INFO_SQL = "INSERT INTO reservations VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
+	public static final String INSERT_HOST_INFO_SQL = "INSERT INTO hosts VALUES (?, ?, ?, ?, ?);";
+	public static final String DELETE_RES_INFO_SQL = "DELETE FROM reservations WHERE uuid = ?";
+	public static final String UPDATE_RES_INFO_SQL = "UPDATE reservations SET start_time = ?, end_time = ? WHERE uuid = ?";
+	public static final String TEST_SQL = "SELECT * FROM reservations WHERE uuid = 'TEST'";
+
+
+	public static final int DEFAULT_POLLING_INTERVAL = 50 *1000;
+	
+	protected static int pollingInterval = DEFAULT_POLLING_INTERVAL;
+	
+	protected Cluster cluster;
+	protected String contactString = System.getProperty(QCG_CONTACT_STRING, "jdbc:mysql://node1.qoscosgrid.man.poznan.pl:3306/qoscosdb?user=qoscosportal&password=test&autoReconnect=true&jdbcCompliantTruncation=false");
+	protected Set<ReservationEndpointReference> activeReservations =  new HashSet<ReservationEndpointReference>();
+	protected Set<ReservationEndpointReference> currentReservations =  new HashSet<ReservationEndpointReference>();
+	protected Map<ReservationEndpointReference, ResInfo> resTimeWindows = new HashMap<ReservationEndpointReference, ResInfo>();
+
+	protected Connection db;
+	protected PreparedStatement resAddStmt;
+	protected PreparedStatement resDelStmt;
+	protected PreparedStatement resUpdateStmt;
+	protected PreparedStatement hostStmt;
+	protected PreparedStatement testStmt;
+	
+	protected class ResInfo {
+		protected Date startTime;
+		protected Date endTime;
+		
+		public ResInfo(Date startTime, Date endTime) {
+			super();
+			this.endTime = endTime;
+			this.startTime = startTime;
+		}
+		
+		public Date getStartTime() {
+			return startTime;
+		}
+		public Date getEndTime() {
+			return endTime;
+		}
+		
+	}
+	/**
+	 * @param args
+	 * @throws JAXBException 
+	 */
+	public static void main(String[] args) throws Exception {
+		
+		Class.forName("com.mysql.jdbc.Driver").newInstance();
+			
+		pollingInterval = Integer.parseInt(System.getProperty(QCG_POLLING_INTERVAL, DEFAULT_POLLING_INTERVAL + ""));
+		
+		Grid grid = new Grid();
+		
+		List<QCGReservationMonitor> monitorsList = new ArrayList<QCGReservationMonitor>();
+		
+		for (Cluster c : grid.getClusters()) {
+			monitorsList.add(new QCGReservationMonitor(c));
+		}
+		
+		for (QCGReservationMonitor m : monitorsList) {
+			m.start();
+		}
+		
+		for (QCGReservationMonitor m : monitorsList) {
+			m.join();
+		}
+	}
+	
+	public QCGReservationMonitor(Cluster cluster) throws JAXBException {
+		this.cluster = cluster; 
+		setName(cluster.getName());
+	}
+
+	protected void createConnection() throws SQLException {
+		db = DriverManager.getConnection(contactString);
+		db.setAutoCommit(false);
+		
+		resAddStmt = db.prepareStatement(INSERT_RES_INFO_SQL);
+		resDelStmt = db.prepareStatement(DELETE_RES_INFO_SQL);
+		resUpdateStmt = db.prepareStatement(UPDATE_RES_INFO_SQL);
+		hostStmt = db.prepareStatement(INSERT_HOST_INFO_SQL);
+		testStmt = db.prepareStatement(TEST_SQL);
+	}
+	
+	protected boolean checkConnection() {
+		try {
+			testStmt.execute();
+			return true;
+		} catch (SQLException ex) {
+			log.severe("Test query failed: " + ex);
+		}
+		
+		log.severe("Reconnecting..");
+		
+		try {
+			resAddStmt.close();
+			resDelStmt.close();
+			resUpdateStmt.close();
+			testStmt.close();
+			db.close();
+		} catch (SQLException e) {
+			e.printStackTrace();
+		}
+		
+		try {
+			createConnection();
+			return true;
+		} catch (SQLException ex) {
+			log.severe("Unable to create connection : " + ex);
+		}
+		
+		return false;
+	}
+	
+	public void run() {
+		log.info("contact string = " + contactString);
+		log.info("polling interval = " + pollingInterval);
+		
+		try {
+			createConnection();
+		} catch (SQLException ex) {
+			ex.printStackTrace();
+			return;
+		}
+		
+		while (true) {
+			currentReservations.clear();
+			
+				List<ReservationEndpointReference> reservations = null;
+				
+				try {
+					log.info("reservation query");
+					reservations = cluster.getAres().getActiveReservations();
+				} catch (Exception ex) {
+					log.info("Unable to get reservation: " + ex);
+					sleep();
+					continue;
+				}
+				
+				currentReservations.addAll(reservations);
+				
+				for (ReservationEndpointReference rEpr : reservations) {
+					if (!activeReservations.contains(rEpr)) {
+						addNewReservation(rEpr);
+					}
+				}
+				
+			
+			Set<ReservationEndpointReference> resToRemove = new HashSet<ReservationEndpointReference>();
+			for (ReservationEndpointReference rEpr : activeReservations) {
+				if (!currentReservations.contains(rEpr)) {
+					
+					log.info("reservation terminated: " + rEpr.getReservationUUID());
+					resToRemove.add(rEpr);
+				}
+			}
+			
+			activeReservations.removeAll(resToRemove);
+
+			Date currentTime = new Date();
+
+			resToRemove.clear();
+			//Delete/update reservation info
+			for (ReservationEndpointReference rEpr : resTimeWindows.keySet()) {
+				ResInfo resInfo = resTimeWindows.get(rEpr);
+				
+				if (resInfo.getEndTime().before(currentTime)) {
+					resToRemove.add(rEpr);
+					log.info("left unchanged (" + resInfo.getEndTime() + "<" + currentTime + "): " + rEpr.getReservationUUID());
+					continue;
+				}
+				
+				if (!activeReservations.contains(rEpr)) {
+					resToRemove.add(rEpr);
+					
+					if (resInfo.getStartTime().after(currentTime)) {
+						deleteReservation(rEpr);
+					} else if (resInfo.getEndTime().after(currentTime)) {
+						updateReservation(rEpr,resInfo.getStartTime(), currentTime);
+					} else {
+						log.info("left unchanged ???: " + rEpr.getReservationUUID());
+					}
+					
+				}
+			}
+			
+			for  (ReservationEndpointReference rEpr : resToRemove) {
+				resTimeWindows.remove(rEpr);
+			}
+
+			sleep();
+		}
+		
+	}
+	
+	private void sleep() {
+		try {
+			Thread.sleep(pollingInterval);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	private void deleteReservation(ReservationEndpointReference epr) {
+		log.info("deleting reservation :" + epr.getReservationUUID());
+		
+		if (!checkConnection())
+			return;
+		
+		try {
+			resDelStmt.setString(1, epr.getReservationUUID());
+			resDelStmt.executeUpdate();
+			db.commit();
+		} catch (SQLException ex) {
+			
+			ex.printStackTrace();
+			
+			try {
+				db.rollback();
+			} catch (SQLException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	private void updateReservation(ReservationEndpointReference epr,Date startTime, Date endTime) {
+		log.info("updating reservation EPR :" + epr.getReservationUUID() + " -> " + endTime);
+		
+		if (!checkConnection())
+			return;
+		
+		try {
+			resUpdateStmt.setTimestamp(1, new Timestamp(startTime.getTime()));
+			resUpdateStmt.setTimestamp(2, new Timestamp(endTime.getTime()));
+			resUpdateStmt.setString(3, epr.getReservationUUID());
+			resUpdateStmt.executeUpdate();
+			db.commit();
+		} catch (SQLException ex) {
+			
+			ex.printStackTrace();
+			
+			try {
+				db.rollback();
+			} catch (SQLException e) {
+				e.printStackTrace();
+			}
+		}
+
+	}
+
+	private void addNewReservation(ReservationEndpointReference epr) {
+		ReservationDocument resDoc = null;
+		ARESReservationStatusType resStat = null;
+		
+		log.info("adding new reservation:" + epr.getReservationUUID());
+		
+		if (!checkConnection())
+			return;	
+
+		try {
+			resDoc = cluster.getAres().getReservationDocument(epr);
+			resStat = cluster.getAres().getReservationStatus(epr);
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			log.info("unable to get reservation stat/doc: " + ex);
+			return;
+		}
+		
+		
+		String uuid = epr.getReservationUUID();
+		String drmsId = resDoc.getLocalReservationId();
+		String name = resDoc.getArdl().getName();
+		
+		//rational: second step of QCG algorithm
+		if (name != null) {
+			name = name.split(":")[0];
+		}
+		
+		String username = resDoc.getArdl().getUserName();
+		Date startTime = resDoc.getArdl().getStartTime();
+		Date endTime = resDoc.getArdl().getEndTime();
+		String description =  resDoc.getArdl().getDescription();
+		
+		try {
+			resAddStmt.setString(1, uuid);
+			resAddStmt.setString(2, cluster.getName());
+			resAddStmt.setString(3, drmsId);
+			resAddStmt.setString(4, name);
+			resAddStmt.setTimestamp(5, new Timestamp(startTime.getTime()));
+			resAddStmt.setTimestamp(6, new Timestamp(endTime.getTime()));
+			resAddStmt.setString(7, username);
+			resAddStmt.setString(8, "user");
+			resAddStmt.setString(9, description);
+			resAddStmt.executeUpdate();
+			
+
+			for (ARESReservedHostType rh : resStat.getReservedHost()){
+				hostStmt.setString(1, uuid);
+				hostStmt.setString(2, rh.getHostName());
+				hostStmt.setInt(3, rh.getReservedSlotsCount().intValue());
+				hostStmt.setInt(4, rh.getTotalSlotsCount().intValue());
+				hostStmt.setInt(5, rh.getUsedSlotsCount().intValue());
+				hostStmt.executeUpdate();
+			}
+			
+			db.commit();
+			activeReservations.add(epr);
+			resTimeWindows.put(epr, new ResInfo(resDoc.getArdl().getStartTime(), resDoc.getArdl().getEndTime()));
+
+		} catch (SQLException ex) {
+			if (ex instanceof com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException) {
+				activeReservations.add(epr);
+				resTimeWindows.put(epr, new ResInfo(resDoc.getArdl().getStartTime(), resDoc.getArdl().getEndTime()));
+			}
+
+			log.info("unable to insert new row: " + ex);
+			try {
+				db.rollback();
+			} catch (SQLException e) {
+				log.info("unable to rollback: " + e);
+			}
+		}
+		
+	}
+	
 
 }
Index: trunk/java/WSIT/QCGReservationMonitor/src/main/resources/resmonitor_mysql.sql
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/src/main/resources/resmonitor_mysql.sql	(revision 326)
+++ trunk/java/WSIT/QCGReservationMonitor/src/main/resources/resmonitor_mysql.sql	(revision 1)
@@ -1,111 +1,30 @@
-DROP DATABASE IF EXISTS testbed;
+DROP TABLE reservations CASCADE;
+DROP TABLE hosts CASCADE;
 
-CREATE DATABASE testbed;
-
-DROP TABLE IF EXISTS reservations;
 CREATE TABLE reservations
 (
-	reservation_id	INT 		NOT NULL AUTO_INCREMENT,
-	cluster_name	CHAR(4) 	NOT NULL,
-	drms_id 	VARCHAR(64) 	NOT NULL,
-	NAME 		VARCHAR(128)	NULL,
-	start_time 	TIMESTAMP	NOT NULL,
-	end_time 	TIMESTAMP 	NOT NULL,
-	username 	VARCHAR(32) 	NOT NULL,
-	description 	VARCHAR(512)	NULL,
+ uuid VARCHAR(64),
+ cluster_name VARCHAR(64),
+ drms_id VARCHAR(64),
+ name VARCHAR(128),
+ start_time TIMESTAMP,
+ end_time TIMESTAMP,
+ username VARCHAR(255),
+ rtype VARCHAR(32) NOT NULL CHECK (rtype in ('user', 'system')),
+ description VARCHAR(512)
+ PRIMARY KEY (uuid)
+);
 
-	PRIMARY KEY (reservation_id)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
+CREATE TABLE hosts
+(
+ res_uuid VARCHAR(64),
+ hostname VARCHAR(255) NOT NULL,
+ reserved_cpus INT NOT NULL,
+ total_cpus INT NOT NULL,
+ used_cpus INT,
+ FOREIGN KEY (res_uuid) REFERENCES reservations(uuid) ON DELETE CASCADE
+);
 
-DROP TABLE IF EXISTS jobs;
-
-CREATE TABLE jobs
-(
-	job_id 		INT 		NOT NULL AUTO_INCREMENT,
-	cluster_name 	CHAR(4)  	NOT NULL,
-	drms_id 	VARCHAR(64) 	NOT NULL,
-	NAME 		VARCHAR(128)	NULL,
-	queue 		VARCHAR(32) 	NOT NULL,
-	reservation_id 	INT	 	NULL,
-	username 	VARCHAR(32) 	NOT NULL,
-	queued_time 	TIMESTAMP 	NOT NULL,
-	start_time 	TIMESTAMP	NULL,
-	end_time 	TIMESTAMP	NULL,
-	est_start_time 	TIMESTAMP	NULL,
-	est_end_time 	TIMESTAMP	NULL,
-	cpu_usage	VARCHAR(32)		NULL, -- in cpu seconds - cumulative
-	mem_usage	BIGINT		NULL, -- in bytes
-	description 	VARCHAR(32)	NULL,
-	PRIMARY KEY (job_id),
-	FOREIGN KEY (reservation_id) REFERENCES reservations(reservation_id) ON DELETE CASCADE
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS `hosts`;
-CREATE TABLE `hosts`
-(
-	host_id 	INT 		NOT NULL AUTO_INCREMENT,
-	cluster_name 	CHAR(4)  	NOT NULL,
-	hostname 	VARCHAR(255) 	NOT NULL,
-	state 		VARCHAR(8) 	NOT NULL CHECK (state IN ('down', 'offline', 'up')),
-	attrs 		VARCHAR(255) 	NOT NULL,  -- coma separated lists of host attributes
-	total_cpus 	INT		NOT NULL,
-	reserved_cpus 	INT 		NOT NULL,
-	used_cpus 	INT		NOT NULL,
-	utilization 	INT		NULL, -- from 0 to 100 x total_cpus
-	architecture 	VARCHAR(16)	NULL,
-	phys_mem 	INT		NULL, -- in bytes
-	virt_mem 	INT		NULL, -- in bytes
-	order_number INT  NOT NULL,
-	history_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`hptemp_ambient` int(11) DEFAULT '0',
-    `hptemp_memory_board` int(11) DEFAULT '0',
-    `hptemp_cpu01` int(11) DEFAULT '0',
-    `hptemp_cpu02` int(11) DEFAULT '0',
-    `hptemp_system_board` int(11) DEFAULT '0',
-	PRIMARY KEY (host_id)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS history_hosts;
-CREATE TABLE history_hosts
-(
-	host_id 	INT 		NOT NULL AUTO_INCREMENT,
-	cluster_name 	CHAR(4)  	NOT NULL,
-	hostname 	VARCHAR(255) 	NOT NULL,
-	state 		VARCHAR(8) 	NOT NULL CHECK (state IN ('down', 'offline', 'up')),
-	attrs 		VARCHAR(255) 	NOT NULL,  -- coma separated lists of host attributes
-	total_cpus 	INT		NOT NULL,
-	reserved_cpus 	INT 		NOT NULL,
-	used_cpus 	INT		NOT NULL,
-	utilization 	INT		NULL, -- from 0 to 100 x total_cpus
-	architecture 	VARCHAR(16)	NULL,
-	phys_mem 	INT		NULL, -- in bytes
-	virt_mem 	INT		NULL, -- in bytes
-	order_number INT  NOT NULL,
-	history_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`hptemp_ambient` int(11) DEFAULT '0',
-    `hptemp_memory_board` int(11) DEFAULT '0',
-    `hptemp_cpu01` int(11) DEFAULT '0',
-    `hptemp_cpu02` int(11) DEFAULT '0',
-    `hptemp_system_board` int(11) DEFAULT '0',
-	PRIMARY KEY (host_id)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS jobs_hosts;
-CREATE TABLE jobs_hosts
-(
-	job_id		INT 		NOT NULL,
-	host_id 	INT		NOT NULL,
-        slots_count     INT             NOT NULL,
-	FOREIGN KEY (job_id) REFERENCES jobs(job_id) ON DELETE CASCADE,
-	FOREIGN KEY (host_id) REFERENCES HOSTS(host_id) ON DELETE CASCADE
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS reservations_hosts;
-CREATE TABLE reservations_hosts
-(
-	reservation_id 	INT 		NOT NULL,
-	host_id 	INT 		NOT NULL,
-        slots_count 	INT 		NOT NULL,
-	FOREIGN KEY (reservation_id) REFERENCES reservations(reservation_id) ON DELETE CASCADE,
-	FOREIGN KEY (host_id) REFERENCES HOSTS(host_id) ON DELETE CASCADE
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
+INSERT INTO reservations VALUES ("urn:uuid:ea9b8a5f-059b-427a-92d1-39bc92f4b47d", "psnc", "usecase9#0", "qcg1234", CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + interval 1 hour, "usecase9", "user");
+INSERT INTO hosts VALUES ('urn:uuid:ea9b8a5f-059b-427a-92d1-39bc92f4b47d', 'node2.qoscosgrid.man.poznan.pl', 2, 4, 0);
+INSERT INTO hosts VALUES ('urn:uuid:ea9b8a5f-059b-427a-92d1-39bc92f4b47d', 'node3.qoscosgrid.man.poznan.pl', 1, 4, 0);
Index: trunk/java/WSIT/QCGReservationMonitor/src/main/resources/resmonitor_postgres.sql
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/src/main/resources/resmonitor_postgres.sql	(revision 1)
+++ trunk/java/WSIT/QCGReservationMonitor/src/main/resources/resmonitor_postgres.sql	(revision 1)
@@ -0,0 +1,28 @@
+DROP TABLE reservations CASCADE;
+DROP TABLE hosts CASCADE;
+
+CREATE TABLE reservations
+(
+ uuid VARCHAR(64) PRIMARY KEY,
+ cluster_name VARCHAR(64),
+ drms_id VARCHAR(64),
+ name VARCHAR(128),
+ start_time TIMESTAMP WITH TIME ZONE,
+ end_time TIMESTAMP WITH TIME ZONE,
+ username VARCHAR(255),
+ description VARCHAR(512),
+ rtype VARCHAR(32) NOT NULL CHECK (rtype in ('user', 'system'))
+);
+
+CREATE TABLE hosts
+(
+ res_uuid VARCHAR(64) REFERENCES reservations(uuid) ON DELETE CASCADE,
+ hostname VARCHAR(255) NOT NULL,
+ reserved_cpus INTEGER NOT NULL,
+ total_cpus INTEGER NOT NULL,
+ used_cpus INTEGER
+);
+
+--INSERT INTO reservations VALUES ('urn:uuid:ea9b8a5f-059b-427a-92d1-39bc92f4b47d', 'psnc', 'usecase9#0', 'qcg1234', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + interval '1 hour', 'usecase9', 'user');
+--INSERT INTO hosts VALUES ('urn:uuid:ea9b8a5f-059b-427a-92d1-39bc92f4b47d', 'node2.qoscosgrid.man.poznan.pl', 2, 4, 0);
+--INSERT INTO hosts VALUES ('urn:uuid:ea9b8a5f-059b-427a-92d1-39bc92f4b47d', 'node3.qoscosgrid.man.poznan.pl', 1, 4, 0);
Index: trunk/java/WSIT/QCGReservationMonitor/src/main/resources/config.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/src/main/resources/config.properties	(revision 326)
+++ 	(revision )
@@ -1,5 +1,0 @@
-#contact string like jdbc:mysql://localhost:3306/database?user=user etc
-qcg.contact.string=jdbc:mysql://localhost:3306/testbed?user=reserv&password=drs_reserv_3&autoReconnect=true&amp;jdbcCompliantTruncation=false
-#url for certificate like C:\\cert.pem
-qcg.certificate.url=D:\\PCSS\\plggrabowskiproxy.pem
-qcg.polling.interval=180000
Index: trunk/java/WSIT/QCGReservationMonitor/pom.xml
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/pom.xml	(revision 326)
+++ trunk/java/WSIT/QCGReservationMonitor/pom.xml	(revision 1)
@@ -1,69 +1,69 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>pl.psnc</groupId>
-    <artifactId>QCGReservationMonitor</artifactId>
-    <packaging>jar</packaging>
-    <version>2.0</version>
-    <name>QCGReservationMonitor</name>
-    <url>http://maven.apache.org</url>
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>3.8.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <artifactId>QCGComputingSDK</artifactId>
-            <groupId>com.qcg</groupId>
-            <version>2.4.1</version>
-        </dependency>
-        <!--dependency>
-           <groupId>postgresql</groupId>
-           <artifactId>postgresql</artifactId>
-           <version>8.0-318.jdbc3</version>
-        </dependency-->
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>5.1.6</version>
-        </dependency>
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>pl.psnc</groupId>
+  <artifactId>QCGReservationMonitor</artifactId>
+  <packaging>jar</packaging>
+  <version>2.0</version>
+  <name>QCGReservationMonitor</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+       <artifactId>QCGComputingSDK</artifactId>
+       <groupId>com.qcg</groupId>
+       <version>2.2.0</version>
+       </dependency>
+       <!--dependency>
+          <groupId>postgresql</groupId>
+          <artifactId>postgresql</artifactId>
+          <version>8.0-318.jdbc3</version>
+       </dependency-->
+       <dependency>
+          <groupId>mysql</groupId>
+          <artifactId>mysql-connector-java</artifactId>
+          <version>5.1.6</version>
+       </dependency>
     </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptorRefs>
-                        <descriptorRef>jar-with-dependencies</descriptorRef>
-                    </descriptorRefs>
-                    <archive>
-                        <manifest>
-                            <addClasspath>true</addClasspath>
-                            <classpathPrefix>lib/</classpathPrefix>
-                            <mainClass>pl.psnc.qcg.rm.QCGReservationMonitor</mainClass>
-                        </manifest>
-                    </archive>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attached</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
+  <build>
+     <plugins>
+        <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <configuration>
+               <descriptorRefs>
+                  <descriptorRef>jar-with-dependencies</descriptorRef>
+               </descriptorRefs>
+               <archive>
+                  <manifest>
+                     <addClasspath>true</addClasspath>
+                     <classpathPrefix>lib/</classpathPrefix>
+                     <mainClass>pl.psnc.qcg.rm.QCGReservationMonitor</mainClass>           
+                  </manifest>
+               </archive>
+            </configuration>
+            <executions>
+               <execution>
+                  <id>make-assembly</id>
+                  <phase>package</phase> 
+                  <goals>
+                     <goal>attached</goal> 
+                  </goals>
+               </execution>
+            </executions>
+         </plugin>
+ 
+        <plugin>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+               <source>1.5</source>
+               <target>1.5</target>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
 </project>
Index: trunk/java/WSIT/QCGReservationMonitor/config.properties
===================================================================
--- trunk/java/WSIT/QCGReservationMonitor/config.properties	(revision 326)
+++ 	(revision )
@@ -1,5 +1,0 @@
-#contact string like jdbc:mysql://localhost:3306/database?user=user etc
-qcg.contact.string=jdbc:mysql://localhost:3306/testbed?user=reserv&password=drs_reserv_3&autoReconnect=true&amp;jdbcCompliantTruncation=false
-#url for certificate like C:\\cert.pem
-qcg.certificate.url=D:\\PCSS\\plggrabowskiproxy.pem
-qcg.polling.interval=180000
Index: trunk/LICENSE
===================================================================
--- trunk/LICENSE	(revision 337)
+++ trunk/LICENSE	(revision 1)
@@ -1,2 +1,202 @@
-This program is released under the GPL with the additional exemption that
-compiling, linking, and/or using OpenSSL is allowed.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 1180)
+++ trunk/configure.ac	(revision 1)
@@ -4,5 +4,5 @@
 #######################################################################################
 
-AC_INIT([QCG Computing], [4.0.0], [], [qcg-comp])
+AC_INIT([QCG Computing], [2.2.3], [], [qcg-comp])
 
 # Developer mode requires gSOAP
@@ -26,4 +26,5 @@
 
 AC_PROG_CC
+AC_PROG_CXX
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -57,5 +58,5 @@
 AC_CHECK_DECLS([PATH_MAX], [], [AC_DEFINE([PATH_MAX], [_POSIX_PATH_MAX])], [#include <limits.h>])
 
-AM_PATH_QCG_CORE([4.0.0],, AC_MSG_ERROR([Could not locate mandatory qcg-core library.]))
+AM_PATH_QCG_CORE([2.1.0],, AC_MSG_ERROR([Could not locate mandatory qcg-core library.]))
 
 LIBCURL_CHECK_CONFIG(["yes"], [7.17.1], [qcg_comp_libcurl="yes"], [qcg_comp_libcurl="no"])
@@ -79,4 +80,13 @@
 AM_CONDITIONAL([WITH_S3], [test "x$have_lib_s3" = "xyes"])
 
+# libactivemq-cpp library
+SMC_CHECK_LIBACTIVEMQ_CPP([have_libactivemq_cpp="yes"],[])
+
+AH_TEMPLATE([WITH_LIBACTIVEMQ_CPP], [bat_updater module])
+if test "x$have_libactivemq_cpp" = "xyes"; then
+	AC_DEFINE(WITH_LIBACTIVEMQ_CPP, [1])
+fi
+
+AM_CONDITIONAL([WITH_LIBACTIVEMQ_CPP], [test "x$have_libactivemq_cpp" = "xyes"])
 
 # RSYNC library
@@ -151,9 +161,7 @@
 		 src/modules/wd_sandboxing/Makefile \
 		 src/modules/pbs_jsdl_filter/Makefile \
-		 src/modules/pbspro_jsdl_filter/Makefile \
 		 src/modules/sge_jsdl_filter/Makefile \
-		 src/modules/slurm_jsdl_filter/Makefile \
-		 src/modules/ll_jsdl_filter/Makefile \
 		 src/modules/application_mapper/Makefile \
+		 src/modules/monitoring_drms/Makefile \
 		 src/modules/notification_wsn/Makefile \
 		 src/modules/python/Makefile \
@@ -163,18 +171,11 @@
 		 src/modules/python/reservation_sge/Makefile \
 		 src/modules/python/reservation_maui/Makefile \
-		 src/modules/python/reservation_moab/Makefile \
-		 src/modules/python/reservation_pbs/Makefile \
-		 src/modules/python/reservation_slurm/Makefile \
-		 src/modules/python/reservation_ll/Makefile \
 		 src/modules/python/jsdl_filter_example/Makefile \
 		 src/modules/python/factory_attr_example/Makefile \
-		 src/modules/python/plgrid_info/Makefile \
-		 src/modules/python/modules_info/Makefile \
-		 src/modules/python/ganglia_info/Makefile \
-		 src/modules/python/vo_info/Makefile \
 		 src/service/Makefile \
 		 src/clients/Makefile \
 		 tools/Makefile \
 		 src/rsync/Makefile \
+		 src/modules/bat_updater/Makefile 
 		 ])
 AC_OUTPUT
@@ -215,4 +216,11 @@
 	echo
 
+echo "- libactivemq-cpp: ${have_libactivemq_cpp:-no}"
+if test "x$have_libactivemq_cpp" = "xyes"; then
+	echo "    LIBACTIVEMQ_CPP_CPPFLAGS=${LIBACTIVEMQ_CPP_CPPFLAGS}"
+	echo "    LIBACTIVEMQ_CPP_LIBS=${LIBACTIVEMQ_CPP_LIBS}"
+fi
+	echo
+
 echo "QCG_COMP_DIR_PREFIX=${prefix}"
 echo
Index: trunk/schemas/interface/qcg-comp-staging.wsdl
===================================================================
--- trunk/schemas/interface/qcg-comp-staging.wsdl	(revision 153)
+++ trunk/schemas/interface/qcg-comp-staging.wsdl	(revision 1)
@@ -4,24 +4,22 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
 <wsdl:definitions xmlns:qcg-comp-staging="http://schemas.qoscosgrid.org/comp/2011/04/staging" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3/org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:jsdl="http://schemas.ggf.org/jsdl/2005/11/jsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:hpcp-fs="http://schemas.ogf.org/hpcp/2007/01/fs" name="QCGComputingStaging" targetNamespace="http://schemas.qoscosgrid.org/comp/2011/04/staging">
   <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
-    <jaxws:package name="org.qcg.comp.stubs.staging"/>
+    <jaxws:package name="com.qcg.comp.stubs.staging"/>
   </jaxws:bindings>
   <wsdl:types>
@@ -30,5 +28,5 @@
         <xsd:appinfo>
           <jxb:schemaBindings>
-            <jxb:package name="org.qcg.comp.stubs.staging"/>
+            <jxb:package name="com.qcg.comp.stubs.staging"/>
           </jxb:schemaBindings>
         </xsd:appinfo>
@@ -232,51 +230,51 @@
   <wsdl:portType name="QCGComputingStagingPortType">
     <wsdl:operation name="StageFilesIn">
-      <wsdl:input name="StageFilesIn" message="qcg-comp-staging:StageFilesInRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StageFilesIn"/>
-      <wsdl:output name="StageFilesInResponse" message="qcg-comp-staging:StageFilesInResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StageFilesInResponse"/>
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
-      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StagingFault"/>
+      <wsdl:input name="StageFilesIn" message="qcg-comp-staging:StageFilesInRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StageFilesIn"/>
+      <wsdl:output name="StageFilesInResponse" message="qcg-comp-staging:StageFilesInResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StageFilesInResponse"/>
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
+      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StagingFault"/>
     </wsdl:operation>
     <wsdl:operation name="StageFilesOut">
-      <wsdl:input name="StageFilesOut" message="qcg-comp-staging:StageFilesOutRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StageFilesOut"/>
-      <wsdl:output name="StageFilesOutResponse" message="qcg-comp-staging:StageFilesOutResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StageFilesOutResponse"/>
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
-      <wsdl:fault name="DeleteOnTerminationFault" message="qcg-comp-staging:DeleteOnTerminationFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/DeleteOnTerminationFault"/>
-      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StagingFault"/>
+      <wsdl:input name="StageFilesOut" message="qcg-comp-staging:StageFilesOutRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StageFilesOut"/>
+      <wsdl:output name="StageFilesOutResponse" message="qcg-comp-staging:StageFilesOutResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StageFilesOutResponse"/>
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
+      <wsdl:fault name="DeleteOnTerminationFault" message="qcg-comp-staging:DeleteOnTerminationFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:DeleteOnTerminationFault"/>
+      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StagingFault"/>
     </wsdl:operation>
     <wsdl:operation name="ListDirectory">
-      <wsdl:input name="ListDirectory" message="qcg-comp-staging:ListDirectoryRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/ListDirectory" />
-      <wsdl:output name="ListDirectoryResponse" message="qcg-comp-staging:ListDirectoryResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/ListDirectoryResponse" />
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
+      <wsdl:input name="ListDirectory" message="qcg-comp-staging:ListDirectoryRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:ListDirectory" />
+      <wsdl:output name="ListDirectoryResponse" message="qcg-comp-staging:ListDirectoryResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:ListDirectoryResponse" />
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
     </wsdl:operation>
     <wsdl:operation name="StatFile">
-      <wsdl:input name="StatFile" message="qcg-comp-staging:StatFileRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StatFile" />
-      <wsdl:output name="StatFileResponse" message="qcg-comp-staging:StatFileResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StatFileResponse" />
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
-      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StagingFault"/>
+      <wsdl:input name="StatFile" message="qcg-comp-staging:StatFileRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StatFile" />
+      <wsdl:output name="StatFileResponse" message="qcg-comp-staging:StatFileResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StatFileResponse" />
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
+      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StagingFault"/>
     </wsdl:operation>
     <wsdl:operation name="Delete">
-      <wsdl:input name="Delete" message="qcg-comp-staging:DeleteRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/Delete" />
-      <wsdl:output name="DeleteResponse" message="qcg-comp-staging:DeleteResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/DeleteResponse" />
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
-      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StagingFault"/>
+      <wsdl:input name="Delete" message="qcg-comp-staging:DeleteRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:Delete" />
+      <wsdl:output name="DeleteResponse" message="qcg-comp-staging:DeleteResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:DeleteResponse" />
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
+      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StagingFault"/>
     </wsdl:operation>
     <wsdl:operation name="ChMod">
-      <wsdl:input name="ChMod" message="qcg-comp-staging:ChModRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/ChMod" />
-      <wsdl:output name="ChModResponse" message="qcg-comp-staging:ChModResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/ChModResponse" />
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
-      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StagingFault"/>
+      <wsdl:input name="ChMod" message="qcg-comp-staging:ChModRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:ChMod" />
+      <wsdl:output name="ChModResponse" message="qcg-comp-staging:ChModResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:ChModResponse" />
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
+      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StagingFault"/>
     </wsdl:operation>
     <wsdl:operation name="MkDir">
-      <wsdl:input name="MkDir" message="qcg-comp-staging:MkDirRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/MkDir" />
-      <wsdl:output name="MkDirResponse" message="qcg-comp-staging:MkDirResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/MkDirResponse" />
-      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/FileNotFoundFault"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/NotAuthorizedFault"/>
-      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging/StagingFault"/>
+      <wsdl:input name="MkDir" message="qcg-comp-staging:MkDirRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:MkDir" />
+      <wsdl:output name="MkDirResponse" message="qcg-comp-staging:MkDirResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:MkDirResponse" />
+      <wsdl:fault name="FileNotFoundFault" message="qcg-comp-staging:FileNotFoundFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:FileNotFoundFault"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-staging:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:NotAuthorizedFault"/>
+      <wsdl:fault name="StagingFault" message="qcg-comp-staging:StagingFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/staging:StagingFault"/>
     </wsdl:operation>
   </wsdl:portType>
@@ -285,5 +283,5 @@
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
     <wsdl:operation name="StageFilesIn">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/StageFilesIn"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:StageFilesIn"/>
       <wsdl:input name="StageFilesIn">
         <soap:body use="literal"/>
@@ -303,5 +301,5 @@
     </wsdl:operation>
     <wsdl:operation name="StageFilesOut">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/StageFilesOut"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:StageFilesOut"/>
       <wsdl:input name="StageFilesOut">
         <soap:body use="literal"/>
@@ -324,5 +322,5 @@
     </wsdl:operation>
     <wsdl:operation name="ListDirectory">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/ListDirectory"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:ListDirectory"/>
       <wsdl:input name="ListDirectory">
         <soap:body use="literal"/>
@@ -339,5 +337,5 @@
     </wsdl:operation>
     <wsdl:operation name="StatFile">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/StatFile"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:StatFile"/>
       <wsdl:input name="StatFile">
         <soap:body use="literal"/>
@@ -357,5 +355,5 @@
     </wsdl:operation>
     <wsdl:operation name="Delete">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/Delete"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:Delete"/>
       <wsdl:input name="Delete">
         <soap:body use="literal"/>
@@ -375,5 +373,5 @@
     </wsdl:operation>
     <wsdl:operation name="ChMod">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/ChMod"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:ChMod"/>
       <wsdl:input name="ChMod">
         <soap:body use="literal"/>
@@ -393,5 +391,5 @@
     </wsdl:operation>
     <wsdl:operation name="MkDir">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging/MkDir"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/staging:MkDir"/>
       <wsdl:input name="MkDir">
         <soap:body use="literal"/>
Index: trunk/schemas/interface/qcg-comp-factory.xsd
===================================================================
--- trunk/schemas/interface/qcg-comp-factory.xsd	(revision 1109)
+++ trunk/schemas/interface/qcg-comp-factory.xsd	(revision 1)
@@ -1,184 +1,108 @@
 <?xml version="1.0" encoding="utf-8"?>
+
 <!-- $Id: qcg-comp-factory.xsd 2588 2009-07-28 11:03:09Z mmamonski $ -->
+
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
 
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+<xsd:schema xmlns:qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/factory" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" targetNamespace="http://schemas.qoscosgrid.org/comp/2011/04/factory" attributeFormDefault="unqualified" jxb:version="1.0" elementFormDefault="qualified">
+  <xsd:annotation>
+    <xsd:appinfo>
+      <jxb:schemaBindings>
+        <jxb:package name="com.qcg.comp.stubs.factory"/>
+      </jxb:schemaBindings>
+    </xsd:appinfo>
+  </xsd:annotation>
+  <!-- Additional substates of Pending -->
+  <xsd:element name="Stage-in">
+    <xsd:complexType>
+		</xsd:complexType>
+  </xsd:element>
+  <xsd:element name="Queued">
+    <xsd:complexType>
+		</xsd:complexType>
+  </xsd:element>
+  <xsd:element name="Held">
+    <xsd:complexType>
+		</xsd:complexType>
+  </xsd:element>
+  <!-- Additional substates of Running -->
+  <xsd:element name="Executing">
+    <xsd:complexType>
+		</xsd:complexType>
+  </xsd:element>
+  <xsd:element name="Suspended">
+    <xsd:complexType>
+		</xsd:complexType>
+  </xsd:element>
+  <xsd:element name="Stage-out">
+    <xsd:complexType>
+		</xsd:complexType>
+  </xsd:element>
+  <!-- The element used in ActivityIdentifier/ReferenceParameters -->
+  <xsd:element name="ActivityId" type="xsd:anyURI"/>
+  <!-- DRMS id -->
+  <xsd:element name="LocalActivityId" type="xsd:string"/>
+  <xsd:element name="ActivityEndStatus" type="qcg-comp-factory:ActivityEndStatus_Type"/>
+  <xsd:complexType name="ActivityEndStatus_Type">
+    <xsd:sequence>
+      <xsd:element name="ExitStatus" type="xsd:nonNegativeInteger" minOccurs="0"/>
+      <xsd:element name="CoreDumped" type="xsd:boolean" minOccurs="0"/>
+      <xsd:element name="POSIXSignalName" type="xsd:string" minOccurs="0"/>
+      <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:anyAttribute namespace="##other" processContents="lax"/>
+  </xsd:complexType>
+ 
+  <xsd:element name="Applications" type="qcg-comp-factory:Applications_Type"/>
+  
+  <xsd:complexType name="Applications_Type">
+    <xsd:sequence>
+      <xsd:element name="Application" minOccurs="0" maxOccurs="unbounded">
+		  <xsd:complexType>
+			<xsd:attribute name="name" type="xsd:string" use="required"/>	
+			<xsd:attribute name="version" type="xsd:string"/>		  
+		  </xsd:complexType>
+	  </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+  
+  <xsd:element name="Modules" type="qcg-comp-factory:Modules_Type"/>
+  
+  <xsd:complexType name="Modules_Type">
+    <xsd:sequence>
+      <xsd:element name="Module" minOccurs="0" maxOccurs="unbounded">
+		  <xsd:complexType>
+			<xsd:attribute name="package" type="xsd:string" use="required"/>	
+		  </xsd:complexType>
+	  </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+    
+  <xsd:element name="NotificationProviderURL" type="xsd:string"/>
 
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
--->
+  <xsd:element name="ReservableSlotsCount" type="xsd:positiveInteger"/>
+  
+  <xsd:element name="AuthorizedUsers" type="qcg-comp-factory:AuthorizedUsers_Type"/>
+  
+  <xsd:complexType name="AuthorizedUsers_Type">
+    <xsd:sequence>
+      <xsd:element name="Subject" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
+    </xsd:sequence>
+  </xsd:complexType>
+   
+</xsd:schema> 
 <!-- vim: set ts=2 sw=2 et: -->
-<xsd:schema targetNamespace="http://schemas.qoscosgrid.org/comp/2011/04/factory" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/factory" elementFormDefault="qualified" attributeFormDefault="unqualified" jxb:version="1.0">
-	<xsd:annotation>
-		<xsd:appinfo>
-			<jxb:schemaBindings>
-				<jxb:package name="org.qcg.comp.stubs.factory"/>
-			</jxb:schemaBindings>
-		</xsd:appinfo>
-	</xsd:annotation>
-	<!-- Additional substates of Pending -->
-	<xsd:element name="Stage-in">
-		<xsd:complexType/>
-	</xsd:element>
-	<xsd:element name="Queued">
-		<xsd:complexType/>
-	</xsd:element>
-	<xsd:element name="Held">
-		<xsd:complexType/>
-	</xsd:element>
-	<!-- Additional substates of Running -->
-	<xsd:element name="Executing">
-		<xsd:complexType/>
-	</xsd:element>
-	<xsd:element name="Suspended">
-		<xsd:complexType/>
-	</xsd:element>
-	<xsd:element name="Stage-out">
-		<xsd:complexType/>
-	</xsd:element>
-	<!-- The element used in ActivityIdentifier/ReferenceParameters -->
-	<xsd:element name="ActivityId" type="xsd:anyURI"/>
-	<!-- DRMS id -->
-	<xsd:element name="LocalActivityId" type="xsd:string"/>
-	<xsd:element name="ActivityEndStatus" type="qcg-comp-factory:ActivityEndStatus_Type"/>
-	<xsd:element name="ActivityInfo" type="qcg-comp-factory:ActivityInfo_Type"/>
-	<xsd:complexType name="ActivityEndStatus_Type">
-		<xsd:sequence>
-			<xsd:element name="ExitStatus" type="xsd:nonNegativeInteger" minOccurs="0"/>
-			<xsd:element name="CoreDumped" type="xsd:boolean" minOccurs="0"/>
-			<xsd:element name="POSIXSignalName" type="xsd:string" minOccurs="0"/>
-			<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-		<xsd:anyAttribute namespace="##other" processContents="lax"/>
-	</xsd:complexType>
-	<xsd:complexType name="ActivityInfo_Type">
-		<xsd:sequence>
-  		<xsd:element name="EstimatedStartTime" type="xsd:dateTime" minOccurs="0"/>
-			<xsd:element name="StartTime" type="xsd:dateTime" minOccurs="0"/>
-			<xsd:element name="EndTime" type="xsd:dateTime" minOccurs="0"/>
-			<xsd:element name="Efficiency" type="xsd:nonNegativeInteger" minOccurs="0"/>
-			<xsd:element name="Comment" type="xsd:string" minOccurs="0"/>
-			<xsd:element name="ExecutionNodes" type="xsd:string" minOccurs="0"/>
-			<xsd:element name="MemoryUsageInMB" type="xsd:nonNegativeInteger" minOccurs="0"/> 
-			<xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-		<xsd:anyAttribute namespace="##any" processContents="lax"/>
-	</xsd:complexType>
-	
-	<xsd:element name="Applications" type="qcg-comp-factory:Applications_Type"/>
-	<xsd:complexType name="Applications_Type">
-		<xsd:sequence>
-			<xsd:element name="Application" minOccurs="0" maxOccurs="unbounded">
-				<xsd:complexType>
-					<xsd:attribute name="name" type="xsd:string" use="required"/>
-					<xsd:attribute name="version" type="xsd:string"/>
-				</xsd:complexType>
-			</xsd:element>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:element name="Modules" type="qcg-comp-factory:Modules_Type"/>
-	<xsd:complexType name="Modules_Type">
-		<xsd:sequence>
-			<xsd:element name="Module" minOccurs="0" maxOccurs="unbounded">
-				<xsd:complexType>
-					<xsd:attribute name="name" type="xsd:string" use="required"/>
-					<xsd:attribute name="version" type="xsd:string" use="required"/>
-				</xsd:complexType>
-			</xsd:element>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="Event_Type">
-		<xsd:simpleContent>
-			<xsd:extension base="xsd:string">
-				<xsd:attribute name="startTime" type="xsd:dateTime" use="required"/>
-				<xsd:attribute name="endTime" type="xsd:dateTime" use="required"/>
-			</xsd:extension>
-		</xsd:simpleContent>
-	</xsd:complexType>
-
-	<xsd:element name="NotificationProviderURL" type="xsd:string"/>
-	<xsd:element name="ReservableSlotsCount" type="xsd:positiveInteger"/>
-
-	<xsd:element name="ScheduledDowntime" type="qcg-comp-factory:Event_Type"/> <!-- downtime -->
-	<xsd:element name="Timestamp"  type="xsd:dateTime"/> <!-- timestamp of the factory attributes -->
-	<xsd:element name="VersionString"  type="xsd:string"/> <!-- version information -->
-	<xsd:element name="AuthorizedVO" type="qcg-comp-factory:AuthorizedVO_Type"/>
-	<xsd:element name="AuthorizedUsers" type="qcg-comp-factory:AuthorizedUsers_Type"/>
-	<xsd:element name="PlGridInfo" type="qcg-comp-factory:PlGridInfo_Type"/>
-	<xsd:element name="Ganglia" type="qcg-comp-factory:Ganglia_Type"/>
-	<xsd:complexType name="AuthorizedUsers_Type">
-		<xsd:sequence>
-			<xsd:element name="Subject" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="AuthorizedVO_Type">
-		<xsd:sequence>
-			<xsd:element name="VO" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="PlGridInfo_Type">
-		<xsd:sequence>
-			<xsd:element name="Users" type="qcg-comp-factory:UsersInfo_Type" />
-			<xsd:element name="Groups" type="qcg-comp-factory:GroupsInfo_Type" />
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="UserInfo_Type">
-		<xsd:sequence>
-			<xsd:element name="DN" type="xsd:string" maxOccurs="unbounded"/>
-			<xsd:element name="Group" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
-			<!--xsd:element name="Grant" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/ look into group-->
-			<xsd:element name="ScratchDir" type="xsd:string" minOccurs="0"/>
-			<xsd:element name="PrivateGrant" type="xsd:string" minOccurs="0"/>
-			<xsd:element name="DefaultGrant" type="xsd:string" minOccurs="0"/>
-		</xsd:sequence>
-		<xsd:attribute name="name" type="xsd:string" use="required"/>
-	</xsd:complexType>
-	<xsd:complexType name="GroupInfo_Type">
-		<xsd:sequence>
-			<xsd:element name="Grant" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
-			<xsd:element name="GroupDir" type="xsd:string" minOccurs="0"/>
-		</xsd:sequence>
-		<xsd:attribute name="name" type="xsd:string" use="required"/>
-	</xsd:complexType>
-	<xsd:complexType name="UsersInfo_Type">
-		<xsd:sequence>
-			<xsd:element name="User" type="qcg-comp-factory:UserInfo_Type" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="GroupsInfo_Type">
-		<xsd:sequence>
-			<xsd:element name="Group" type="qcg-comp-factory:GroupInfo_Type" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="Ganglia_Type">
-		<xsd:sequence>
-			<xsd:element name="H" type="qcg-comp-factory:GangliaHost_Type" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-	</xsd:complexType>
-	<xsd:complexType name="GangliaHost_Type">
-		<xsd:sequence>
-			<xsd:element name="M" type="qcg-comp-factory:GangliaMetric_Type" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:sequence>
-		<xsd:attribute name="nm" type="xsd:string" use="required"/>
-	</xsd:complexType>
-	<xsd:complexType name="GangliaMetric_Type">
-		<xsd:simpleContent>
-			<xsd:extension base="xsd:string">
-				<xsd:attribute name="nm" type="xsd:string" use="required"/>
-			</xsd:extension>
-		</xsd:simpleContent>
-	</xsd:complexType>
-
-
-
-</xsd:schema>
Index: trunk/schemas/interface/Makefile.am
===================================================================
--- trunk/schemas/interface/Makefile.am	(revision 61)
+++ trunk/schemas/interface/Makefile.am	(revision 1)
@@ -8,5 +8,5 @@
 		      jsdl-qcg-comp-factory.xsd jsdl.xsd bes-factory.wsdl \
 		      bes-management.wsdl qcg-comp-ares.xsd qcg-comp-staging.wsdl \
-		      jsdl-qcg-comp-ares.xsd jsdl-hpcpa.xsd hpcp-bp.xsd qcg-comp-monitoring.xsd
+		      jsdl-qcg-comp-ares.xsd jsdl-hpcpa.xsd hpcp-bp.xsd
 
 if WITH_LIBRSYNC
Index: trunk/schemas/interface/qcg-comp-rsync.wsdl
===================================================================
--- trunk/schemas/interface/qcg-comp-rsync.wsdl	(revision 8)
+++ trunk/schemas/interface/qcg-comp-rsync.wsdl	(revision 1)
@@ -10,5 +10,5 @@
 >
 <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
-   <jaxws:package name="org.qcg.comp.stubs.rsync"/>
+   <jaxws:package name="com.qcg.comp.stubs.rsync"/>
 </jaxws:bindings>
 
@@ -18,5 +18,5 @@
                   <xsd:appinfo>
                      <jxb:schemaBindings>
-                        <jxb:package name="org.qcg.comp.stubs.rsync"/>
+                        <jxb:package name="com.qcg.comp.stubs.rsync"/>
                      </jxb:schemaBindings>
                   </xsd:appinfo>
Index: trunk/schemas/interface/bes-factory.xsd
===================================================================
--- trunk/schemas/interface/bes-factory.xsd	(revision 1109)
+++ trunk/schemas/interface/bes-factory.xsd	(revision 1)
@@ -15,10 +15,9 @@
 -->
 
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:bes-factory="http://schemas.ggf.org/bes/2006/08/bes-factory" xmlns:jsdl="http://schemas.ggf.org/jsdl/2005/11/jsdl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qcg-comp-monitoring="http://schemas.qoscosgrid.org/comp/2011/04/monitoring" xmlns:qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/factory" targetNamespace="http://schemas.ggf.org/bes/2006/08/bes-factory" elementFormDefault="qualified" attributeFormDefault="unqualified">
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:bes-factory="http://schemas.ggf.org/bes/2006/08/bes-factory" xmlns:jsdl="http://schemas.ggf.org/jsdl/2005/11/jsdl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/factory" targetNamespace="http://schemas.ggf.org/bes/2006/08/bes-factory" elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
   <xsd:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2002/ws/addr/ns/ws-addr"/>
   <xsd:import namespace="http://schemas.ggf.org/jsdl/2005/11/jsdl" schemaLocation="./jsdl.xsd"/>
   <xsd:import namespace="http://schemas.qoscosgrid.org/comp/2011/04/factory" schemaLocation="./qcg-comp-factory.xsd"/>
-  <xsd:import namespace="http://schemas.qoscosgrid.org/comp/2011/04/monitoring" schemaLocation="./qcg-comp-monitoring.xsd"/>
   <!-- Attribute Document Types -->
   <xsd:complexType name="BasicResourceAttributesDocumentType">
@@ -31,11 +30,4 @@
       <xsd:element name="PhysicalMemory" type="xsd:double" minOccurs="0"/>
       <xsd:element name="VirtualMemory" type="xsd:double" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:Utilization"  minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:Attributes"  minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:State"  minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:UsedCPUCount"  minOccurs="0"/>  
-      <xsd:element ref="qcg-comp-monitoring:ReservedCPUCount"  minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:Dedicated"  minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:GPUCount"  minOccurs="0"/>
       <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
@@ -56,15 +48,5 @@
       <xsd:element name="LocalResourceManagerType" type="xsd:anyURI"/>
       <xsd:element ref="qcg-comp-factory:AuthorizedUsers" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:AuthorizedVO" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:Applications" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:PlGridInfo" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:Modules" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:Ganglia" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-monitoring:ClusterMonitoring" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:ReservableSlotsCount" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:ScheduledDowntime" minOccurs="0"/> <!-- downtime -->
-      <xsd:element ref="qcg-comp-factory:Timestamp"  minOccurs="0"/> <!-- timestamp of the factory attributes -->
-      <xsd:element ref="qcg-comp-factory:VersionString"  minOccurs="0"/> <!-- version information -->
-      <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> 
+      <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
     <xsd:anyAttribute namespace="##other" processContents="lax"/>
@@ -99,5 +81,4 @@
       </xsd:choice>
       <xsd:element ref="qcg-comp-factory:ActivityEndStatus" minOccurs="0"/>
-      <xsd:element ref="qcg-comp-factory:ActivityInfo" minOccurs="0"/>
       <!-- From HPC File Staging Profile -->
       <xsd:element name="Fault" type="soap:Fault" minOccurs="0"/>
Index: trunk/schemas/interface/ardl.xsd
===================================================================
--- trunk/schemas/interface/ardl.xsd	(revision 1109)
+++ trunk/schemas/interface/ardl.xsd	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -25,5 +23,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.ares.ardl"/>
+        <jxb:package name="com.qcg.comp.stubs.ares.ardl"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
@@ -51,7 +49,7 @@
   <xsd:complexType name="ARDLReservationIdentification_Type">
     <xsd:sequence>
-      <xsd:element name="ReservationName" type="xsd:Name" minOccurs="0"/>
+      <xsd:element name="ReservationName" type="xsd:string" minOccurs="0"/>
       <xsd:element ref="ardl:Description" minOccurs="0"/>
-      <xsd:element name="Project" type="xsd:Name" minOccurs="0" maxOccurs="unbounded"/>
+      <xsd:element name="Project" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
       <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
@@ -76,6 +74,4 @@
       <xsd:element name="ReservedSlotsCount" type="xsd:nonNegativeInteger" minOccurs="0"/>
       <xsd:element name="AdditionalReservedSlotsCount" type="xsd:nonNegativeInteger" minOccurs="0"/>
-      <xsd:element name="ReservedNodesCount" type="xsd:nonNegativeInteger" minOccurs="0"/>
-      <xsd:element name="ReservedSlotsPerNode" type="xsd:nonNegativeInteger" minOccurs="0"/>
       <xsd:element name="ExclusiveExecution" type="xsd:boolean" minOccurs="0" default="false"/>
       <xsd:element name="CandidateHosts" type="ardl:ARDLCandidateHosts_Type" minOccurs="0"/>
@@ -86,7 +82,7 @@
       <xsd:element name="IndividualSwapMemory" type="xsd:nonNegativeInteger" minOccurs="0"/>
       <xsd:element name="UserName" type="xsd:string" minOccurs="0"/>
-      <xsd:element name="GroupName" type="xsd:NCName" minOccurs="0"/>
+      <xsd:element name="GroupName" type="xsd:string" minOccurs="0"/>
       <xsd:element name="NativeResource" type="ardl:ARDLNativeResource_Type" minOccurs="0" maxOccurs="unbounded"/>
-      <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+      <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
     <xsd:anyAttribute namespace="##other" processContents="lax"/>
@@ -94,5 +90,5 @@
   <xsd:complexType name="ARDLCandidateHosts_Type">
     <xsd:sequence>
-      <xsd:element name="HostName" type="xsd:NCName" maxOccurs="unbounded"/>
+      <xsd:element name="HostName" type="xsd:string" maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>
@@ -106,6 +102,6 @@
   <xsd:complexType name="ARDLNativeResource_Type">
     <xsd:simpleContent>
-      <xsd:extension base="xsd:nonNegativeInteger">
-        <xsd:attribute name="name" type="xsd:NCName" use="required"/>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="name" type="xsd:string" use="required"/>
       </xsd:extension>
     </xsd:simpleContent>
Index: trunk/schemas/interface/jsdl-hpcpa.xsd
===================================================================
--- trunk/schemas/interface/jsdl-hpcpa.xsd	(revision 8)
+++ trunk/schemas/interface/jsdl-hpcpa.xsd	(revision 1)
@@ -39,5 +39,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.jsdl.hpcpa"/>
+        <jxb:package name="com.qcg.comp.stubs.jsdl.hpcpa"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
Index: trunk/schemas/interface/jsdl-qcg-comp-ares.xsd
===================================================================
--- trunk/schemas/interface/jsdl-qcg-comp-ares.xsd	(revision 153)
+++ trunk/schemas/interface/jsdl-qcg-comp-ares.xsd	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -25,5 +23,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.jsdl.ares"/>
+        <jxb:package name="com.qcg.comp.stubs.jsdl.ares"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
@@ -32,6 +30,5 @@
   <xsd:complexType name="Reservation_Type">
     <xsd:sequence>
-      <xsd:element name="ReservationIdentifier" type="wsa:EndpointReferenceType" minOccurs="0" />
-      <xsd:element name="LocalReservationIdentifier" type="xsd:string" minOccurs="0"/>
+      <xsd:element name="ReservationIdentifier" type="wsa:EndpointReferenceType"/>
       <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
Index: trunk/schemas/interface/bes-factory.wsdl
===================================================================
--- trunk/schemas/interface/bes-factory.wsdl	(revision 8)
+++ trunk/schemas/interface/bes-factory.wsdl	(revision 1)
@@ -17,5 +17,5 @@
 <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bes-factory="http://schemas.ggf.org/bes/2006/08/bes-factory" xmlns:wsa="http://www.w3/org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:hpcp-bp="http://schemas.ogf.org/hpcp/2007/01/bp" name="BESFactory" targetNamespace="http://schemas.ggf.org/bes/2006/08/bes-factory">
   <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
-    <jaxws:package name="org.qcg.comp.stubs.bes.factory"/>
+    <jaxws:package name="com.qcg.comp.stubs.bes.factory"/>
   </jaxws:bindings>
   <wsdl:types>
@@ -24,5 +24,5 @@
         <xsd:appinfo>
           <jxb:schemaBindings>
-            <jxb:package name="org.qcg.comp.stubs.bes.factory"/>
+            <jxb:package name="com.qcg.comp.stubs.bes.factory"/>
           </jxb:schemaBindings>
         </xsd:appinfo>
Index: trunk/schemas/interface/hpcp-bp.xsd
===================================================================
--- trunk/schemas/interface/hpcp-bp.xsd	(revision 8)
+++ trunk/schemas/interface/hpcp-bp.xsd	(revision 1)
@@ -20,5 +20,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.hpcp.bf"/>
+        <jxb:package name="com.qcg.comp.stubs.hpcp.bf"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
Index: trunk/schemas/interface/jsdl-qcg-comp-staging.xsd
===================================================================
--- trunk/schemas/interface/jsdl-qcg-comp-staging.xsd	(revision 170)
+++ trunk/schemas/interface/jsdl-qcg-comp-staging.xsd	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -25,11 +23,10 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.jsdl.staging"/>
+        <jxb:package name="com.qcg.comp.stubs.jsdl.staging"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
   </xsd:annotation>
   <xsd:element name="FileMode" type="xsd:string"/>
-  <xsd:element name="Offset" type="xsd:long"/>
-  <xsd:element name="Size" type="xsd:long"/>
+  <xsd:element name="Offset" type="xsd:int"/>
 </xsd:schema>
 <!-- vim: set ts=2 sw=2 et: -->
Index: trunk/schemas/interface/jsdl.xsd
===================================================================
--- trunk/schemas/interface/jsdl.xsd	(revision 929)
+++ trunk/schemas/interface/jsdl.xsd	(revision 1)
@@ -17,5 +17,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.jsdl"/>
+        <jxb:package name="com.qcg.comp.stubs.jsdl"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
@@ -241,8 +241,5 @@
       <xsd:element xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory" ref="jsdl-qcg-comp-factory:NativeSpecification" minOccurs="0"/>
 	  <xsd:element xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory" ref="jsdl-qcg-comp-factory:Queue" minOccurs="0"/>
-      <xsd:element xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory" ref="jsdl-qcg-comp-factory:NodeProperties" minOccurs="0"/>
-      <xsd:element xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory" ref="jsdl-qcg-comp-factory:ConsumableResources" minOccurs="0"/>
       <xsd:element xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory" ref="jsdl-qcg-comp-factory:JobCategory" minOccurs="0"/>
-      <xsd:element xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory" ref="jsdl-qcg-comp-factory:GPUSCount" minOccurs="0"/>
       <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
@@ -306,5 +303,4 @@
       <xsd:element xmlns:jsdl-qcg-comp-staging="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/staging"  ref="jsdl-qcg-comp-staging:FileMode" minOccurs="0"/>
       <xsd:element xmlns:jsdl-qcg-comp-staging="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/staging"  ref="jsdl-qcg-comp-staging:Offset" minOccurs="0"/>
-      <xsd:element xmlns:jsdl-qcg-comp-staging="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/staging"  ref="jsdl-qcg-comp-staging:Size" minOccurs="0"/>
       <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
Index: trunk/schemas/interface/bes-management.wsdl
===================================================================
--- trunk/schemas/interface/bes-management.wsdl	(revision 8)
+++ trunk/schemas/interface/bes-management.wsdl	(revision 1)
@@ -17,5 +17,5 @@
 <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bes-mgmt="http://schemas.ggf.org/bes/2006/08/bes-management" xmlns:bes-factory="http://schemas.ggf.org/bes/2006/08/bes-factory" xmlns:wsa="http://www.w3/org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="BESManagement" targetNamespace="http://schemas.ggf.org/bes/2006/08/bes-management">
   <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
-    <jaxws:package name="org.qcg.comp.stubs.bes.management"/>
+    <jaxws:package name="com.qcg.comp.stubs.bes.management"/>
   </jaxws:bindings>
   <wsdl:import namespace="http://schemas.ggf.org/bes/2006/08/bes-factory" location="bes-factory.wsdl"/>
@@ -25,5 +25,5 @@
         <xsd:appinfo>
           <jxb:schemaBindings>
-            <jxb:package name="org.qcg.comp.stubs.bes.management"/>
+            <jxb:package name="com.qcg.comp.stubs.bes.management"/>
           </jxb:schemaBindings>
         </xsd:appinfo>
Index: trunk/schemas/interface/qcg-comp-ares.xsd
===================================================================
--- trunk/schemas/interface/qcg-comp-ares.xsd	(revision 153)
+++ trunk/schemas/interface/qcg-comp-ares.xsd	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -25,5 +23,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.ares"/>
+        <jxb:package name="com.qcg.comp.stubs.ares"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
Index: trunk/schemas/interface/hpcp-fs.xsd
===================================================================
--- trunk/schemas/interface/hpcp-fs.xsd	(revision 8)
+++ trunk/schemas/interface/hpcp-fs.xsd	(revision 1)
@@ -19,5 +19,5 @@
     <xs:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.hpcp.fs"/>
+        <jxb:package name="com.qcg.comp.stubs.hpcp.fs"/>
       </jxb:schemaBindings>
     </xs:appinfo>
Index: trunk/schemas/interface/qcg-comp-socks.wsdl
===================================================================
--- trunk/schemas/interface/qcg-comp-socks.wsdl	(revision 153)
+++ trunk/schemas/interface/qcg-comp-socks.wsdl	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -29,5 +27,5 @@
 	targetNamespace="http://schemas.qoscosgrid.org/comp/2011/04/socks">
   <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
-    <jaxws:package name="org.qcg.comp.stubs.socks"/>
+    <jaxws:package name="com.qcg.comp.stubs.socks"/>
   </jaxws:bindings>
   <wsdl:types>
@@ -36,5 +34,5 @@
         <xsd:appinfo>
           <jxb:schemaBindings>
-            <jxb:package name="org.qcg.comp.stubs.socks"/>
+            <jxb:package name="com.qcg.comp.stubs.socks"/>
           </jxb:schemaBindings>
         </xsd:appinfo>
@@ -79,7 +77,7 @@
   <wsdl:portType name="QCGComputingSocksPortType">
     <wsdl:operation name="GetConnectionToken">
-      <wsdl:input name="GetConnectionToken" message="qcg-comp-socks:GetConnectionTokenRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/socks/GetConnectionToken"/>
-      <wsdl:output name="GetConnectionTokenResponse" message="qcg-comp-socks:GetConnectionTokenResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/socks/GetConnectionTokenResponse"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-socks:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/socks/NotAuthorizedFault"/>
+      <wsdl:input name="GetConnectionToken" message="qcg-comp-socks:GetConnectionTokenRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/socks:GetConnectionToken"/>
+      <wsdl:output name="GetConnectionTokenResponse" message="qcg-comp-socks:GetConnectionTokenResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/socks:GetConnectionTokenResponse"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-socks:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/socks:NotAuthorizedFault"/>
     </wsdl:operation>
   </wsdl:portType>
@@ -88,5 +86,5 @@
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
     <wsdl:operation name="GetConnectionToken">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/socks/GetConnectionToken"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/socks:GetConnectionToken"/>
       <wsdl:input name="GetConnectionToken">
         <soap:body use="literal"/>
Index: trunk/schemas/interface/jsdl-qcg-comp-factory.xsd
===================================================================
--- trunk/schemas/interface/jsdl-qcg-comp-factory.xsd	(revision 929)
+++ trunk/schemas/interface/jsdl-qcg-comp-factory.xsd	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -25,5 +23,5 @@
     <xsd:appinfo>
       <jxb:schemaBindings>
-        <jxb:package name="org.qcg.comp.stubs.jsdl.factory"/>
+        <jxb:package name="com.qcg.comp.stubs.jsdl.factory"/>
       </jxb:schemaBindings>
     </xsd:appinfo>
@@ -31,8 +29,5 @@
   <xsd:element name="NativeSpecification" type="xsd:string"/>
   <xsd:element name="Queue" type="xsd:string"/>
-  <xsd:element name="NodeProperties" type="xsd:string"/>
-  <xsd:element name="ConsumableResources" type="xsd:string"/>
   <xsd:element name="JobCategory" type="xsd:string"/>
-  <xsd:element name="GPUSCount" type="xsd:string"/>
 </xsd:schema>
 <!-- vim: set ts=2 sw=2 et: -->
Index: trunk/schemas/interface/qcg-comp-ares.wsdl
===================================================================
--- trunk/schemas/interface/qcg-comp-ares.wsdl	(revision 153)
+++ trunk/schemas/interface/qcg-comp-ares.wsdl	(revision 1)
@@ -4,24 +4,22 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
 <wsdl:definitions xmlns:qcg-comp-ares="http://schemas.qoscosgrid.org/comp/2011/04/ares" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="QCGComputingAdvanceReservation" targetNamespace="http://schemas.qoscosgrid.org/comp/2011/04/ares">
   <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
-    <jaxws:package name="org.qcg.comp.stubs.ares"/>
+    <jaxws:package name="com.qcg.comp.stubs.ares"/>
   </jaxws:bindings>
   <wsdl:types>
@@ -213,34 +211,34 @@
   <wsdl:portType name="QCGComputingAdvanceReservationPortType">
     <wsdl:operation name="CreateReservation">
-      <wsdl:input name="CreateReservation" message="qcg-comp-ares:CreateReservationRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/CreateReservation"/>
-      <wsdl:output name="CreateReservationResponse" message="qcg-comp-ares:CreateReservationResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/CreateReservationResponse"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NotAuthorizedFault"/>
-      <wsdl:fault name="UnsupportedFeatureFault" message="qcg-comp-ares:UnsupportedFeatureFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/UnsupportedFeatureFault"/>
-      <wsdl:fault name="InvalidRequestMessageFault" message="qcg-comp-ares:InvalidRequestMessageFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/InvalidRequestMessageFault"/>
-      <wsdl:fault name="NoSlotsAvailableFault" message="qcg-comp-ares:NoSlotsAvailableFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NoSlotsAvailableFault"/>
-      <wsdl:fault name="NoMatchingResourcesFault" message="qcg-comp-ares:NoMatchingResourcesFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NoMatchingResourcesFault"/>
+      <wsdl:input name="CreateReservation" message="qcg-comp-ares:CreateReservationRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:CreateReservation"/>
+      <wsdl:output name="CreateReservationResponse" message="qcg-comp-ares:CreateReservationResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:CreateReservationResponse"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NotAuthorizedFault"/>
+      <wsdl:fault name="UnsupportedFeatureFault" message="qcg-comp-ares:UnsupportedFeatureFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:UnsupportedFeatureFault"/>
+      <wsdl:fault name="InvalidRequestMessageFault" message="qcg-comp-ares:InvalidRequestMessageFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:InvalidRequestMessageFault"/>
+      <wsdl:fault name="NoSlotsAvailableFault" message="qcg-comp-ares:NoSlotsAvailableFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NoSlotsAvailableFault"/>
+      <wsdl:fault name="NoMatchingResourcesFault" message="qcg-comp-ares:NoMatchingResourcesFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NoMatchingResourcesFault"/>
     </wsdl:operation>
     <wsdl:operation name="GetReservationStatus">
-      <wsdl:input name="GetReservationStatus" message="qcg-comp-ares:GetReservationStatusRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetReservationDocument"/>
-      <wsdl:output name="GetReservationStatusResponse" message="qcg-comp-ares:GetReservationStatusResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetReservationDocumentResponse"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NotAuthorizedFault"/>
-      <wsdl:fault name="UnknownReservationIdentifierFault" message="qcg-comp-ares:UnknownReservationIdentifierFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/UnknownReservationIdentifierFault"/>
+      <wsdl:input name="GetReservationStatus" message="qcg-comp-ares:GetReservationStatusRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetReservationDocument"/>
+      <wsdl:output name="GetReservationStatusResponse" message="qcg-comp-ares:GetReservationStatusResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetReservationDocumentResponse"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NotAuthorizedFault"/>
+      <wsdl:fault name="UnknownReservationIdentifierFault" message="qcg-comp-ares:UnknownReservationIdentifierFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:UnknownReservationIdentifierFault"/>
     </wsdl:operation>
     <wsdl:operation name="GetReservationDocument">
-      <wsdl:input name="GetReservationDocument" message="qcg-comp-ares:GetReservationDocumentRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetReservationDocument"/>
-      <wsdl:output name="GetReservationDocumentResponse" message="qcg-comp-ares:GetReservationDocumentResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetReservationDocumentResponse"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NotAuthorizedFault"/>
-      <wsdl:fault name="UnknownReservationIdentifierFault" message="qcg-comp-ares:UnknownReservationIdentifierFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/UnknownReservationIdentifierFault"/>
+      <wsdl:input name="GetReservationDocument" message="qcg-comp-ares:GetReservationDocumentRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetReservationDocument"/>
+      <wsdl:output name="GetReservationDocumentResponse" message="qcg-comp-ares:GetReservationDocumentResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetReservationDocumentResponse"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NotAuthorizedFault"/>
+      <wsdl:fault name="UnknownReservationIdentifierFault" message="qcg-comp-ares:UnknownReservationIdentifierFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:UnknownReservationIdentifierFault"/>
     </wsdl:operation>
     <wsdl:operation name="GetActiveReservations">
-      <wsdl:input name="GetActiveReservations" message="qcg-comp-ares:GetActiveReservationsRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetActiveReservations"/>
-      <wsdl:output name="GetActiveReservationsResponse" message="qcg-comp-ares:GetActiveReservationsResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetActiveReservationsResponse"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NotAuthorizedFault"/>
+      <wsdl:input name="GetActiveReservations" message="qcg-comp-ares:GetActiveReservationsRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetActiveReservations"/>
+      <wsdl:output name="GetActiveReservationsResponse" message="qcg-comp-ares:GetActiveReservationsResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetActiveReservationsResponse"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NotAuthorizedFault"/>
     </wsdl:operation>
     <wsdl:operation name="TerminateReservation">
-      <wsdl:input name="TerminateReservation" message="qcg-comp-ares:TerminateReservationRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/TerminateReservation"/>
-      <wsdl:output name="TerminateReservationResponse" message="qcg-comp-ares:TerminateReservationResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/TerminateReservationResponse"/>
-      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/NotAuthorizedFault"/>
-      <wsdl:fault name="UnknownReservationIdentifierFault" message="qcg-comp-ares:UnknownReservationIdentifierFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares/UnknownReservationIdentifierFault"/>
+      <wsdl:input name="TerminateReservation" message="qcg-comp-ares:TerminateReservationRequest" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:TerminateReservation"/>
+      <wsdl:output name="TerminateReservationResponse" message="qcg-comp-ares:TerminateReservationResponse" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:TerminateReservationResponse"/>
+      <wsdl:fault name="NotAuthorizedFault" message="qcg-comp-ares:NotAuthorizedFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:NotAuthorizedFault"/>
+      <wsdl:fault name="UnknownReservationIdentifierFault" message="qcg-comp-ares:UnknownReservationIdentifierFault" wsa:Action="http://schemas.qoscosgrid.org/comp/2011/04/ares:UnknownReservationIdentifierFault"/>
     </wsdl:operation>
   </wsdl:portType>
@@ -249,5 +247,5 @@
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
     <wsdl:operation name="CreateReservation">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares/CreateReservation"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares:CreateReservation"/>
       <wsdl:input name="CreateReservation">
         <soap:body use="literal"/>
@@ -273,5 +271,5 @@
     </wsdl:operation>
     <wsdl:operation name="TerminateReservation">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares/TerminateReservation"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares:TerminateReservation"/>
       <wsdl:input name="TerminateReservation">
         <soap:body use="literal"/>
@@ -288,5 +286,5 @@
     </wsdl:operation>
     <wsdl:operation name="GetReservationStatus">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetReservationStatus"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetReservationStatus"/>
       <wsdl:input name="GetReservationStatus">
         <soap:body use="literal"/>
@@ -303,5 +301,5 @@
     </wsdl:operation>
     <wsdl:operation name="GetReservationDocument">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetReservationDocument"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetReservationDocument"/>
       <wsdl:input name="GetReservationDocument">
         <soap:body use="literal"/>
@@ -318,5 +316,5 @@
     </wsdl:operation>
     <wsdl:operation name="GetActiveReservations">
-      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares/GetActiveReservations"/>
+      <soap:operation soapAction="http://schemas.qoscosgrid.org/comp/2011/04/ares:GetActiveReservations"/>
       <wsdl:input name="GetActiveReservations">
         <soap:body use="literal"/>
Index: trunk/schemas/interface/qcg-comp-monitoring.xsd
===================================================================
--- trunk/schemas/interface/qcg-comp-monitoring.xsd	(revision 1109)
+++ 	(revision )
@@ -1,101 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://schemas.qoscosgrid.org/comp/2011/04/monitoring" xmlns:monitoring="http://schemas.qoscosgrid.org/comp/2011/04/monitoring" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0" >
-  <xs:annotation>
-	<xs:appinfo>
-		<jxb:schemaBindings>
-			<jxb:package name="org.qcg.comp.stubs.monitoring"/>
-		</jxb:schemaBindings>
-	</xs:appinfo>
-  </xs:annotation>
-  <xs:element name="ClusterMonitoring">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element ref="monitoring:Queues"/>
-        <xs:element ref="monitoring:Jobs"/>
-        <xs:element ref="monitoring:Reservations"/>
-      </xs:sequence>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Queues">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element  minOccurs="0" maxOccurs="unbounded" ref="monitoring:Queue"/>
-      </xs:sequence>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Queue">
-    <xs:complexType>
-      <xs:attribute name="name" type="xs:string"/>
-      <xs:attribute name="runningJobs" type="xs:integer"/>
-      <xs:attribute name="waitingJobs" type="xs:integer"/>
-      <xs:attribute name="walltime" type="xs:duration"/>
-      <xs:attribute name="started" type="xs:boolean"/>
-      <xs:attribute name="enabled" type="xs:boolean"/>
-      <xs:attribute name="default" type="xs:boolean"/>
-      <xs:anyAttribute namespace="##any" processContents="lax"/>
-    </xs:complexType>
-  </xs:element>
- 
-  <xs:element name="Jobs">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element  minOccurs="0" maxOccurs="unbounded" ref="monitoring:Job"/>
-      </xs:sequence>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Job">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element minOccurs="0" maxOccurs="unbounded" ref="monitoring:Host"/>
-      </xs:sequence>
-      <xs:attribute name="cpuTime" type="xs:string"/>
-      <xs:attribute name="desc" type="xs:string"/>
-      <xs:attribute name="resId" type="xs:string"/>
-      <xs:attribute name="endTime" type="xs:dateTime"/>
-      <xs:attribute name="estEndTime" type="xs:dateTime"/>
-      <xs:attribute name="estStartTime" type="xs:dateTime"/>
-      <xs:attribute name="id" use="required" type="xs:string"/>
-      <xs:attribute name="memUsage" type="xs:string"/>
-      <xs:attribute name="name" use="required" type="xs:string"/>
-      <xs:attribute name="owner" use="required" type="xs:string"/>
-      <xs:attribute name="queue" use="required" type="xs:string"/>
-      <xs:attribute name="startTime" type="xs:dateTime"/>
-      <xs:attribute name="submissionTime" use="required" type="xs:dateTime"/>
-      <xs:attribute name="cores"  type="xs:integer"/>
-      <xs:anyAttribute namespace="##any" processContents="lax"/>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Reservations">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element minOccurs="0" maxOccurs="unbounded" ref="monitoring:Reservation"/>
-      </xs:sequence>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Reservation">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element  minOccurs="0" maxOccurs="unbounded" ref="monitoring:Host"/>
-      </xs:sequence>
-      <xs:attribute name="endTime" use="required" type="xs:dateTime"/>
-      <xs:attribute name="name" use="required" type="xs:string"/>
-      <xs:attribute name="startTime" use="required" type="xs:dateTime"/>
-      <xs:attribute name="type" use="required" type="xs:string"/>
-      <xs:anyAttribute namespace="##any" processContents="lax"/>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Host">
-    <xs:complexType>
-      <xs:attribute name="name" use="required" type="xs:string"/>
-      <xs:attribute name="slots" type="xs:integer"/>
-      <xs:anyAttribute namespace="##any" processContents="lax"/>
-    </xs:complexType>
-  </xs:element>
-  <xs:element name="Utilization" type="xs:double"/>
-  <xs:element name="Attributes" type="xs:string"/>
-  <xs:element name="State" type="xs:string"/>
-  <xs:element name="UsedCPUCount" type="xs:integer"/>
-  <xs:element name="ReservedCPUCount" type="xs:integer"/>
-  <xs:element name="Dedicated" type="xs:boolean"/>
-  <xs:element name="GPUCount" type="xs:integer"/>
-</xs:schema>
Index: trunk/schemas/conf/qcg-comp.xsd.in
===================================================================
--- trunk/schemas/conf/qcg-comp.xsd.in	(revision 1109)
+++ trunk/schemas/conf/qcg-comp.xsd.in	(revision 1)
@@ -4,19 +4,17 @@
 
 <!--
- QosCosGrid Computing
- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>
+  Copyright 2006-2009 QCG Project Team
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
 -->
 
@@ -48,11 +46,9 @@
 					<xsd:element name="ARESFactoryPortEnabled" type="xsd:boolean" minOccurs="0" default="true"/>
 					<xsd:element name="QCGStagingPortEnabled" type="xsd:boolean" minOccurs="0" default="true"/>
-					<xsd:element name="QCGRsyncPortEnabled" type="xsd:boolean" minOccurs="0" default="true"/>
+					<xsd:element name="QCGRsyncPortEnabled" type="xsd:boolean" minOccurs="0" default="true"/>					
 					<xsd:element name="SetuidEnabled" type="xsd:boolean" minOccurs="0" default="true"/>
-					<xsd:element name="RedirectStdouterr" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false"/>
 					<xsd:element name="SessionProcessTimeout" type="xsd:positiveInteger" minOccurs="0" default="10"/>
 					<xsd:element name="ReservationVacuumPeriod" type="xsd:nonNegativeInteger" minOccurs="0" default="300"/>
 					<xsd:element name="JobStatusPollingPeriod" type="xsd:nonNegativeInteger" minOccurs="0" default="10"/>
-					<xsd:element name="FactoryAttributesLifetime" type="xsd:nonNegativeInteger" minOccurs="0" default="300"/>
 					<xsd:element name="JobStatusFullPolling" type="xsd:boolean" minOccurs="0" default="true"/>
 					<xsd:element name="SubmittedJobsHashTable" type="xsd:positiveInteger" minOccurs="0" default="4096"/>
@@ -62,10 +58,7 @@
 					<xsd:element name="ReturnListOfActivities" type="xsd:boolean" minOccurs="0" default="true"/>
 					<xsd:element name="ReturnListOfContainedResources" type="xsd:boolean" minOccurs="0" default="true"/>
-					<xsd:element name="UseScratch" type="xsd:boolean" minOccurs="0" default="false"/>
-					<xsd:element name="UseDatabaseState" type="xsd:boolean" minOccurs="0" default="true"/>
 					<xsd:element name="ReservationsAdministrator" type="xsd:string" minOccurs="0"/>
-					<xsd:element name="ReservationsPolicy" type="smc:ReservationsPolicyType" minOccurs="0"/>
 					<xsd:element name="SOCKSPolicy" type="smc:SOCKSPolicyType" minOccurs="0"/>
-					<xsd:element name="AcceptingNewActivities" type="xsd:boolean" minOccurs="0" default="true"/> 
+					<xsd:element name="AdministratorDN" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
 					<xsd:element name="FactoryAttributes" type="smc:FactoryAttributesType" minOccurs="0"/>
 				</xsd:sequence>
@@ -106,5 +99,5 @@
 			<xsd:element name="LongDescription" type="xsd:string" minOccurs="0"/>
 			<xsd:element name="LocalResourceManagerType" type="xsd:anyURI" minOccurs="0"/>
-  		<xsd:element name="ContainedResources" type="smc:ContainedResourcesType" minOccurs="0"/>
+			<xsd:element name="ContainedResources" type="smc:ContainedResourcesType" minOccurs="0"/>
 			<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
 		</xsd:sequence>
@@ -118,23 +111,14 @@
 		</xsd:sequence>
 		<xsd:attribute name="bindPort" type="xsd:positiveInteger" use="required"/>
-		<xsd:attribute name="authentication" type="smc:SOCKSAuthenticationType" use="optional"/>
-	</xsd:complexType>
-	
-	<xsd:complexType name="ReservationsPolicyType">
-		<xsd:sequence>
-			<xsd:element name="MaxDuration" type="xsd:positiveInteger" minOccurs="1"  maxOccurs="1"/> <!-- in hours, default: one week -->
-			<xsd:element name="MaxSlots" type="xsd:positiveInteger" minOccurs="0"  maxOccurs="1"/>
-			<xsd:element name="MaxReservations" type="xsd:positiveInteger" minOccurs="0"  maxOccurs="1"/>
-			<xsd:element name="MaxReservationsUser" type="xsd:positiveInteger" minOccurs="0"  maxOccurs="1"/>
-		</xsd:sequence>
-	</xsd:complexType>
-
-	<xsd:simpleType name="SOCKSAuthenticationType">
-		<xsd:restriction base="xsd:string">
-			<xsd:enumeration value="perConnection"/>
-			<xsd:enumeration value="perSession"/>
-			<xsd:enumeration value="none"/>
-		</xsd:restriction>
-	</xsd:simpleType>
+		<xsd:attribute name="authentication" type="smc:SOCKSAuthenticationType" use="required"/>
+	</xsd:complexType>
+
+  <xsd:simpleType name="SOCKSAuthenticationType">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="perConnection"/>
+      <xsd:enumeration value="perSession"/>
+      <xsd:enumeration value="none"/>
+    </xsd:restriction>
+  </xsd:simpleType>
 	
 	<xsd:complexType name="HostMaskedType">
@@ -301,10 +285,4 @@
 		</xsd:complexContent>
 	</xsd:complexType>
-
-	<xsd:complexType name="slurm_jsdl_filter">
-		<xsd:complexContent>
-			<xsd:extension base="sm:ModuleType"/>
-		</xsd:complexContent>
-	</xsd:complexType>
 	
 	<xsd:complexType name="sge_jsdl_filter">
@@ -314,28 +292,10 @@
 	</xsd:complexType>
 	
-	<xsd:complexType name="ll_jsdl_filter">
-		<xsd:complexContent>
-			<xsd:extension base="sm:ModuleType"/>
-		</xsd:complexContent>
-	</xsd:complexType>
-	
 	<xsd:complexType name="pbs_jsdl_filter">
 		<xsd:complexContent>
-			<xsd:extension base="sm:ModuleType">
-				<xsd:sequence>
-						<xsd:element name="TCCExpression" type="xsd:string" minOccurs="0"/>
-						<xsd:element name="MPINodeProperty" type="xsd:string" minOccurs="0"/>
-						<xsd:element name="Partitions" type="xsd:string" minOccurs="0"/>
-				</xsd:sequence>
-			</xsd:extension>
-		</xsd:complexContent>
-	</xsd:complexType>
-
-	<xsd:complexType name="pbspro_jsdl_filter">
-		<xsd:complexContent>
-			<xsd:extension base="sm:ModuleType"/>
-		</xsd:complexContent>
-	</xsd:complexType>
-		
+			<xsd:extension base="sm:ModuleType"/>
+		</xsd:complexContent>
+	</xsd:complexType>
+	
 	<xsd:complexType name="wd_sandboxing">
 		<xsd:complexContent>
@@ -362,5 +322,4 @@
 			<xsd:extension base="sm:ModuleType">
 				<xsd:sequence>
-					<xsd:element name="PublishedBrokerURL" type="xsd:string" minOccurs="0"/>
 					<xsd:element ref="sm:Module"/>
 				</xsd:sequence>
@@ -368,5 +327,16 @@
 		</xsd:complexContent>
 	</xsd:complexType>
-
+	
+	<xsd:complexType name="bat_updater">
+		<xsd:complexContent>
+			<xsd:extension base="sm:ModuleType">
+				<xsd:sequence>
+					<xsd:element name="BATServiceURL" type="xsd:string"/>
+					<xsd:element name="SiteName" type="xsd:string"/>
+					<xsd:element name="QueueName" type="xsd:string"/>
+				</xsd:sequence>
+			</xsd:extension>
+		</xsd:complexContent>
+	</xsd:complexType>
 
 </xsd:schema>
Index: trunk/schemas/db/Makefile.am
===================================================================
--- trunk/schemas/db/Makefile.am	(revision 630)
+++ trunk/schemas/db/Makefile.am	(revision 1)
@@ -3,3 +3,3 @@
 dbdir = $(pkgdatadir)/db
 
-dist_db_DATA = qcg-comp-psql.sql qcg-comp-psql2.sql qcg-comp-migrate-2.X-to-3.0-psql.sql
+dist_db_DATA = qcg-comp-psql.sql
Index: trunk/schemas/db/qcg-comp-psql.sql
===================================================================
--- trunk/schemas/db/qcg-comp-psql.sql	(revision 619)
+++ trunk/schemas/db/qcg-comp-psql.sql	(revision 1)
@@ -2,19 +2,17 @@
 
 --
--- QosCosGrid Computing
--- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+-- Copyright 2006-2009 QCG Project Team
 --
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
 --
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--- GNU General Public License for more details.
+--     http://www.apache.org/licenses/LICENSE-2.0
 --
--- You should have received a copy of the GNU General Public License
--- along with this program.  If not, see <http://www.gnu.org/licenses/>
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
 --
 
@@ -45,5 +43,5 @@
 	serial SERIAL PRIMARY KEY,
 
-	id VARCHAR(36) NOT NULL UNIQUE,
+	id VARCHAR(36) NOT NULL,
 	drms_id VARCHAR(255) UNIQUE,
 
@@ -74,8 +72,5 @@
 	project VARCHAR(255),
 	walltime INTEGER,
-	nodes TEXT,
-	cancelled BOOLEAN,
-	domain VARCHAR(255),
-	ext_info TEXT
+	nodes TEXT
 );
 
@@ -88,5 +83,5 @@
 	serial SERIAL PRIMARY KEY,
 
-	id VARCHAR(36) NOT NULL UNIQUE,
+	id VARCHAR(36) NOT NULL,
 	drms_id VARCHAR(255),
 
@@ -117,9 +112,6 @@
 	project VARCHAR(255),
 	walltime INTEGER,
-	nodes TEXT,
-	cancelled BOOLEAN,
-	domain VARCHAR(255),
-	ext_info TEXT
-
+	nodes TEXT
+	
 );
 
Index: trunk/schemas/db/qcg-comp-migrate-2.X-to-3.0-psql.sql
===================================================================
--- trunk/schemas/db/qcg-comp-migrate-2.X-to-3.0-psql.sql	(revision 630)
+++ 	(revision )
@@ -1,9 +1,0 @@
-
-ALTER TABLE jobs ADD COLUMN cancelled BOOLEAN;
-ALTER TABLE jobs ADD COLUMN domain VARCHAR(255);
-ALTER TABLE jobs ADD COLUMN ext_info TEXT;
-
-ALTER TABLE jobs_acc ADD COLUMN cancelled BOOLEAN;
-ALTER TABLE jobs_acc ADD COLUMN domain VARCHAR(255);
-ALTER TABLE jobs_acc ADD COLUMN ext_info TEXT;
-
Index: trunk/schemas/db/qcg-comp-psql2.sql
===================================================================
--- trunk/schemas/db/qcg-comp-psql2.sql	(revision 619)
+++ 	(revision )
@@ -1,182 +1,0 @@
--- $Id: qcg-comp-psql.sql 2588 2009-07-28 11:03:09Z mmamonski $
-
---
--- QosCosGrid Computing
--- Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
---
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program.  If not, see <http://www.gnu.org/licenses/>
---
-
-DROP TABLE IF EXISTS states CASCADE;
-DROP TABLE IF EXISTS jobs CASCADE;
-DROP TABLE IF EXISTS jobs_acc CASCADE;
-DROP TABLE IF EXISTS reservations CASCADE;
-DROP TABLE IF EXISTS reservations_acc CASCADE;
-DROP TABLE IF EXISTS accounts_pool CASCADE;
-
-CREATE TABLE states
-(
-	name VARCHAR(16) PRIMARY KEY
-);
-
-INSERT INTO states VALUES ('Stage-in');
-INSERT INTO states VALUES ('Queued');
-INSERT INTO states VALUES ('Held');
-INSERT INTO states VALUES ('Executing');
-INSERT INTO states VALUES ('Suspended');
-INSERT INTO states VALUES ('Stage-out');
-INSERT INTO states VALUES ('Finished');
-INSERT INTO states VALUES ('Failed');
-INSERT INTO states VALUES ('Cancelled');
-
-CREATE TABLE jobs
-(
-	serial SERIAL PRIMARY KEY,
-
-	id VARCHAR(36) NOT NULL UNIQUE,
-	drms_id VARCHAR(255) UNIQUE,
-
-	reservation_id VARCHAR(36),
-
-	submitted_jsdl TEXT NOT NULL,
-	jsdl TEXT NOT NULL,
-
-	subject TEXT NOT NULL,
-	mapped_user VARCHAR(255) NOT NULL,
-
-	state VARCHAR(16) NOT NULL REFERENCES states(name),
-	staging_fault TEXT,
-
-	submission_time TIMESTAMP WITH TIME ZONE NOT NULL,
-	start_time TIMESTAMP WITH TIME ZONE,
-	end_time TIMESTAMP WITH TIME ZONE,
-	CONSTRAINT valid_start_end CHECK (end_time >= start_time),
-
-	exit_status INTEGER,
-	core_dumped BOOLEAN,
-	posix_signal_name VARCHAR(32),
-
-	cpu_usage DOUBLE PRECISION,
-	mem_usage DOUBLE PRECISION,
-	vmem_usage DOUBLE PRECISION,
-	queue VARCHAR(255),
-	project VARCHAR(255),
-	walltime INTEGER,
-	nodes TEXT,
-	cancelled BOOLEAN,
-	domain VARCHAR(255),
-	ext_info TEXT
-);
-
-CREATE INDEX jobs_id_idx on jobs(id);
-CREATE INDEX jobs_drms_id_idx on jobs(drms_id);
-CREATE INDEX jobs_reservation_id_idx on jobs(reservation_id);
-
-CREATE TABLE jobs_acc
-(
-	serial SERIAL PRIMARY KEY,
-
-	id VARCHAR(36) NOT NULL UNIQUE,
-	drms_id VARCHAR(255),
-
-	reservation_id VARCHAR(36),
-
-	submitted_jsdl TEXT NOT NULL,
-	jsdl TEXT NOT NULL,
-
-	subject TEXT NOT NULL,
-	mapped_user VARCHAR(255) NOT NULL,
-
-	state VARCHAR(16) NOT NULL REFERENCES states(name),
-	staging_fault TEXT,
-
-	submission_time TIMESTAMP WITH TIME ZONE NOT NULL,
-	start_time TIMESTAMP WITH TIME ZONE,
-	end_time TIMESTAMP WITH TIME ZONE,
-	CONSTRAINT valid_start_end CHECK (end_time >= start_time),
-
-	exit_status INTEGER,
-	core_dumped BOOLEAN,
-	posix_signal_name VARCHAR(32),
-
-	cpu_usage DOUBLE PRECISION,
-	mem_usage DOUBLE PRECISION,
-	vmem_usage DOUBLE PRECISION,
-	queue VARCHAR(255),
-	project VARCHAR(255),
-	walltime INTEGER,
-	nodes TEXT,
-	cancelled BOOLEAN,
-	domain VARCHAR(255),
-	ext_info TEXT
-
-);
-
-CREATE INDEX jobs_acc_id_idx on jobs_acc(id);
-CREATE INDEX jobs_acc_drms_id_idx on jobs_acc(drms_id);
-CREATE INDEX jobs_acc_reservation_id_idx on jobs_acc(reservation_id);
-
-CREATE TABLE reservations
-(
-	id VARCHAR(36) PRIMARY KEY,
-	drms_id VARCHAR(255) NOT NULL,
-
-	submitted_ardl TEXT NOT NULL,
-	ardl TEXT NOT NULL,
-
-	subject TEXT NOT NULL,
-	mapped_user VARCHAR(255) NOT NULL,
-
-	submission_time TIMESTAMP WITH TIME ZONE NOT NULL,
-	start_time TIMESTAMP WITH TIME ZONE NOT NULL,
-	end_time TIMESTAMP WITH TIME ZONE NOT NULL,
-	nodes TEXT,
-	CONSTRAINT valid_start_end CHECK (end_time >= start_time)
-);
-
-CREATE INDEX reservations_drms_id_idx on reservations(drms_id);
-
-CREATE TABLE reservations_acc
-(
-	id VARCHAR(36) PRIMARY KEY,
-	drms_id VARCHAR(255) NOT NULL,
-
-	submitted_ardl TEXT NOT NULL,
-	ardl TEXT NOT NULL,
-
-	subject TEXT NOT NULL,
-	mapped_user VARCHAR(255) NOT NULL,
-
-	submission_time TIMESTAMP WITH TIME ZONE NOT NULL,
-	start_time TIMESTAMP WITH TIME ZONE,
-	end_time TIMESTAMP WITH TIME ZONE,
-	nodes TEXT,
-	CONSTRAINT valid_start_end CHECK (end_time >= start_time)
-);
-
-CREATE INDEX reservations_acc_drms_id_idx on reservations_acc(drms_id);
-
-CREATE TABLE accounts_pool
-(
-	account_name VARCHAR(255) PRIMARY KEY,
-	home_dir VARCHAR(255) NOT NULL,
-	uid INTEGER NOT NULL UNIQUE,
-	ref_count INTEGER NOT NULL,
-	subject TEXT UNIQUE,
-	last_access_time TIMESTAMP WITH TIME ZONE,
-	expires_on TIMESTAMP WITH TIME ZONE 
-	CONSTRAINT ref_count_non_negative CHECK (ref_count >= 0)
-);
-
-CREATE INDEX accounts_pool_subject_idx on accounts_pool(subject);
Index: trunk/autoclean.sh
===================================================================
--- trunk/autoclean.sh	(revision 153)
+++ trunk/autoclean.sh	(revision 1)
@@ -1,19 +1,19 @@
 #!/bin/sh
 #
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+# $Id: autoclean.sh 2312 2009-04-15 17:31:24Z mmamonski $
 #
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# Copyright 2006-2009 QCG Project Team
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
 #
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 
Index: trunk/doc/examples/jsdl/sleep.xml
===================================================================
--- trunk/doc/examples/jsdl/sleep.xml	(revision 517)
+++ trunk/doc/examples/jsdl/sleep.xml	(revision 1)
@@ -3,18 +3,16 @@
 <jsdl:JobDefinition
  xmlns:jsdl="http://schemas.ggf.org/jsdl/2005/11/jsdl"
- xmlns:jsdl-hpcpa="http://schemas.ggf.org/jsdl/2006/07/jsdl-hpcpa"
- xmlns:jsdl-qcg-comp-factory="http://schemas.qoscosgrid.org/comp/2011/04/jsdl/factory">
+ xmlns:jsdl-hpcpa="http://schemas.ggf.org/jsdl/2006/07/jsdl-hpcpa">
    <jsdl:JobDescription>
       <jsdl:JobIdentification>
          <jsdl:JobName>Sleep</jsdl:JobName>
-         <jsdl:Description>sleep comment</jsdl:Description>
       </jsdl:JobIdentification>
       <jsdl:Application>
          <jsdl-hpcpa:HPCProfileApplication>
             <jsdl-hpcpa:Executable>/bin/sleep</jsdl-hpcpa:Executable>
-            <jsdl-hpcpa:Argument>60</jsdl-hpcpa:Argument>
+            <jsdl-hpcpa:Argument>90</jsdl-hpcpa:Argument>
         </jsdl-hpcpa:HPCProfileApplication>
       </jsdl:Application>
-    </jsdl:JobDescription>
+   </jsdl:JobDescription>
 </jsdl:JobDefinition>
 
Index: trunk/doc/examples/jsdl/date.xml
===================================================================
--- trunk/doc/examples/jsdl/date.xml	(revision 932)
+++ trunk/doc/examples/jsdl/date.xml	(revision 1)
@@ -12,4 +12,5 @@
             <jsdl-hpcpa:Executable>/bin/date</jsdl-hpcpa:Executable>
             <jsdl-hpcpa:Output>date.out</jsdl-hpcpa:Output>
+            <jsdl-hpcpa:Environment name="TZ">Pacific/Honolulu</jsdl-hpcpa:Environment>
         </jsdl-hpcpa:HPCProfileApplication>
       </jsdl:Application>
Index: trunk/doc/examples/jsdl/beshpc.xml
===================================================================
--- trunk/doc/examples/jsdl/beshpc.xml	(revision 146)
+++ trunk/doc/examples/jsdl/beshpc.xml	(revision 1)
@@ -34,6 +34,4 @@
          </jsdl:TotalCPUCount>
          <jsdl-qcg-comp-factory:Queue>priority</jsdl-qcg-comp-factory:Queue>
-         <jsdl-qcg-comp-factory:NodeProperties>bigmem</jsdl-qcg-comp-factory:NodeProperties>
-         <jsdl-qcg-comp-factory:ConsumableResources>matlab:1</jsdl-qcg-comp-factory:ConsumableResources>
          <!--jsdl-qcg-comp-factory:JobCategory>mpi-job</jsdl-qcg-comp-factory:JobCategory-->
       </jsdl:Resources>
Index: trunk/src/rsync/attachment.h
===================================================================
--- trunk/src/rsync/attachment.h	(revision 338)
+++ trunk/src/rsync/attachment.h	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifndef ATTACHMENTH
 #define ATTACHMENTH
Index: trunk/src/rsync/client.c
===================================================================
--- trunk/src/rsync/client.c	(revision 338)
+++ trunk/src/rsync/client.c	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
Index: trunk/src/rsync/client.h
===================================================================
--- trunk/src/rsync/client.h	(revision 338)
+++ trunk/src/rsync/client.h	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifndef QCG_COMP_RSYNCH
 #define QCG_COMP_RSYNCH
Index: trunk/src/rsync/icomm.c
===================================================================
--- trunk/src/rsync/icomm.c	(revision 338)
+++ trunk/src/rsync/icomm.c	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
Index: trunk/src/rsync/interface.h
===================================================================
--- trunk/src/rsync/interface.h	(revision 338)
+++ trunk/src/rsync/interface.h	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifndef INTERFACEH
 #define INTERFACEH
Index: trunk/src/rsync/attachment.c
===================================================================
--- trunk/src/rsync/attachment.c	(revision 338)
+++ trunk/src/rsync/attachment.c	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
Index: trunk/src/rsync/qcg-comp-rsync.wsdl
===================================================================
--- trunk/src/rsync/qcg-comp-rsync.wsdl	(revision 2)
+++ trunk/src/rsync/qcg-comp-rsync.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../schemas/interface/qcg-comp-rsync.wsdl
+link ../../schemas/interface/smoa-comp-rsync.wsdl
Index: trunk/src/rsync/types.h
===================================================================
--- trunk/src/rsync/types.h	(revision 338)
+++ trunk/src/rsync/types.h	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifndef TYPESH
 #define TYPESH
Index: trunk/src/rsync/base.c
===================================================================
--- trunk/src/rsync/base.c	(revision 338)
+++ trunk/src/rsync/base.c	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
@@ -136,5 +115,6 @@
 
 	// intensional use of malloc, because we need to invoke rs_free_sumset later to release memory allocated by rs_build_hash_table
-	if (!(sig= sm_malloc(sizeof(rs_signature_t))))
+	sig = sm_malloc(sizeof(rs_signature_t));
+	if(sig==NULL)
 		return SM_DEBUG_LEAVE_INT(RSyncNoMemoryError);
 	memset(sig,0,sizeof(rs_signature_t));
@@ -149,5 +129,7 @@
 		Length i;
 
-		if (!(sig->block_sigs = sm_calloc(sig->count,sizeof(rs_block_sig_t)))) {
+		sig->block_sigs = sm_calloc(sig->count,sizeof(rs_block_sig_t));
+
+		if(!sig->block_sigs) {
 			sm_free(sig);
 			return SM_DEBUG_LEAVE_INT(RSyncNoMemoryError);
@@ -155,6 +137,7 @@
 
 		buf_len = sig->strong_sum_len*4/3+2;
-
-		if (!(buf = sm_malloc(buf_len))) {
+		buf = sm_malloc(buf_len);
+
+		if(!buf) {
 			sm_free(sig);
 			sm_free(sig->block_sigs);
@@ -353,5 +336,8 @@
 	}
 
-	if (!(input=sm_malloc(BUFFER_SIZE)) || !(blob=sm_malloc(BUFFER_SIZE))) {
+	input=sm_malloc(BUFFER_SIZE);
+	blob=sm_malloc(BUFFER_SIZE);
+
+	if(!input || !blob) {
 		error = RSyncNoMemoryError;
 		goto quit;
@@ -577,5 +563,5 @@
 	SM_DEBUG_ENTER_INT(pos);
 
-	sm_info("lseek(%d, %lld)", fd, pos);
+	sm_info("lseek(%d, %d)", fd, pos);
 	if(lseek(fd, pos, SEEK_SET) != pos) {
 		sm_perror("wrapper_lseek");
Index: trunk/src/service/Makefile.am
===================================================================
--- trunk/src/service/Makefile.am	(revision 205)
+++ trunk/src/service/Makefile.am	(revision 1)
@@ -12,5 +12,5 @@
 		      $(QCG_CORE_CPPFLAGS)
 
-qcg_compd_LDADD = ../common/libcommon.la $(QCG_CORE_LIBS) 
+qcg_compd_LDADD = $(QCG_CORE_LIBS) ../common/libcommon.la
 
 qcg_coordinatord_SOURCES = qcg_coordinatord.c 
Index: trunk/src/service/qcg_compd.c
===================================================================
--- trunk/src/service/qcg_compd.c	(revision 623)
+++ trunk/src/service/qcg_compd.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -54,7 +47,6 @@
 	api = SM_API_ALL;
 
-	api &= ~SUBMISSION_MODULE_API;
-	api &= ~SM_API_GENERAL_PYTHON;
-	/*api &= ~RESERVATION_MODULE_API; we need to load reservation module in main service process because we want it to be discoverable*/
+	/*api &= ~SUBMISSION_MODULE_API*/
+	api &= ~RESERVATION_MODULE_API;
 
 	smc_common_setup();
Index: trunk/src/service/qcg_coordinatord.c
===================================================================
--- trunk/src/service/qcg_coordinatord.c	(revision 338)
+++ trunk/src/service/qcg_coordinatord.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/clients/qcg_coordinator.c
===================================================================
--- trunk/src/clients/qcg_coordinator.c	(revision 338)
+++ trunk/src/clients/qcg_coordinator.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/clients/qcg_comp.c
===================================================================
--- trunk/src/clients/qcg_comp.c	(revision 338)
+++ trunk/src/clients/qcg_comp.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/include/extensions.h
===================================================================
--- trunk/src/include/extensions.h	(revision 338)
+++ trunk/src/include/extensions.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_EXTENSIONS_H
Index: trunk/src/include/namespaces.h
===================================================================
--- trunk/src/include/namespaces.h	(revision 636)
+++ trunk/src/include/namespaces.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_NAMESPACES_H
@@ -45,5 +38,5 @@
 #define SMC_NAMESPACE_STAGING                   "http://schemas.qoscosgrid.org/comp/2011/04/staging"
 #define SMC_NAMESPACE_RSYNC                     "http://schemas.qoscosgrid.org/comp/2011/04/rsync"
-#define SMC_NAMESPACE_SOCKS			"http://schemas.qoscosgrid.org/comp/2011/04/socks"
+#define SMC_NAMESPACE_SOCKS						"http://schemas.qoscosgrid.org/comp/2011/04/socks"
 
 #define SMC_NAMESPACE_CONFIG                    "http://schemas.qoscosgrid.org/comp/2011/04/config"
@@ -57,12 +50,6 @@
 #define SMC_NAMESPACE_DRMS_CONDOR               "http://schemas.qoscosgrid.org/comp/2011/04/drms/Condor"
 #define SMC_NAMESPACE_DRMS_XGRID                "http://schemas.qoscosgrid.org/comp/2011/04/drms/XGrid"
-#define SMC_NAMESPACE_DRMS_SLURM                "http://schemas.qoscosgrid.org/comp/2011/04/drms/SLURM"
-#define SMC_NAMESPACE_DRMS_LL                   "http://schemas.qoscosgrid.org/comp/2011/04/drms/LL"
 #define SMC_NAMESPACE_DRMS_UNKNOWN              "http://schemas.qoscosgrid.org/comp/2011/04/drms/Unknown"
 
-/* Capabilities */
-#define SMC_NAMESPACE_EXT_JSDL_TOTAL_CPU_COUNT  "http://schemas.qoscosgrid.org/comp/2012/07/jsdl/TotalCPUCount"
-#define SMC_NAMESPACE_EXT_ADVANCE_RESERVATION   "http://schemas.qoscosgrid.org/comp/2012/07/AdvanceReservation"
-#define SMC_NAMESPACE_EXT_ADVANCE_RESERV_NODES  "http://schemas.qoscosgrid.org/comp/2012/07/AdvanceReservation/Nodes"
 
 
Index: trunk/src/include/submission_module.h
===================================================================
--- trunk/src/include/submission_module.h	(revision 388)
+++ trunk/src/include/submission_module.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_SUBMISSION_MODULE_H
@@ -38,6 +31,5 @@
 	SUBMISSION_UNSUPPORTED_FEATURE_FAULT,
 	SUBMISSION_UNKNOWN_ACTIVITY_IDENTIFIER_FAULT,
-	SUBMISSION_INVALID_REQUEST_MESSAGE_FAULT,
-	SUBMISSION_WAIT_TIMEOUT_FAULT
+	SUBMISSION_INVALID_REQUEST_MESSAGE_FAULT
 } submission_ret_code_t;
 
@@ -48,7 +40,5 @@
 	SUBMISSION_DRMS_TORQUE,
 	SUBMISSION_DRMS_PBSPRO,
-	SUBMISSION_DRMS_XGRID,
-	SUBMISSION_DRMS_SLURM,
-	SUBMISSION_DRMS_LL
+	SUBMISSION_DRMS_XGRID
 } submission_drms_t;
 
@@ -80,16 +70,13 @@
 **/
 typedef sm_value_t *(*submission_wait_function)(sm_module_t this);
-typedef sm_value_t *(*submission_wait_single_function)(sm_module_t this, sm_value_t *identifier);
-
 typedef sm_value_t *(*submission_get_drms_function)(sm_module_t this);
 
 typedef struct submission_module_s {
-	struct sm_module_s header;
+        struct sm_module_s header;
 
-	submission_submit_function submit;
+        submission_submit_function submit;
 	submission_terminate_function terminate;
 	submission_get_statuses_function get_statuses;
 	submission_wait_function wait;
-	submission_wait_single_function wait_single;
 	submission_get_drms_function get_drms;
 } *submission_module_t;
Index: trunk/src/include/jsdl_filter.h
===================================================================
--- trunk/src/include/jsdl_filter.h	(revision 510)
+++ trunk/src/include/jsdl_filter.h	(revision 1)
@@ -2,30 +2,21 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_JSDL_FILTER_H
 #define __SMC_JSDL_FILTER_H
-
-#include <include/namespaces.h>
 
 typedef enum {
Index: trunk/src/include/staging_module.h
===================================================================
--- trunk/src/include/staging_module.h	(revision 338)
+++ trunk/src/include/staging_module.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_STAGING_MODULE_H
Index: trunk/src/include/Makefile.am
===================================================================
--- trunk/src/include/Makefile.am	(revision 1109)
+++ trunk/src/include/Makefile.am	(revision 1)
@@ -8,4 +8,3 @@
 		     ardl_filter.h \
 		     extensions.h \
-		     namespaces.h \
-			 pbs_args.h
+		     namespaces.h
Index: trunk/src/include/reservation_module.h
===================================================================
--- trunk/src/include/reservation_module.h	(revision 338)
+++ trunk/src/include/reservation_module.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_RESERVATION_MODULE_H
@@ -52,8 +45,8 @@
 
 typedef struct reservation_module_s {
-	struct sm_module_s header;
+        struct sm_module_s header;
 
-	reservation_create_function create;
-	reservation_terminate_function terminate;
+        reservation_create_function create;
+        reservation_terminate_function terminate;
 	reservation_get_status_function get_status;
 	reservation_get_active_function get_active;
Index: trunk/src/include/ardl_filter.h
===================================================================
--- trunk/src/include/ardl_filter.h	(revision 338)
+++ trunk/src/include/ardl_filter.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_ARDL_FILTER_H
Index: trunk/src/include/pbs_args.h
===================================================================
--- trunk/src/include/pbs_args.h	(revision 1109)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/* $Id: pbs_args.h 2014-11-20 10:00:00Z plgkopta $ */
-
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
-
-#ifndef __SMC_PBS_ARGS_H
-#define __SMC_PBS_ARGS_H
-
-
-typedef char* (*insert_string_ft)(char *, size_t, size_t, const char *, void *);
-
-
-/**
- * Merge arguments of single parameter.
- *
- * Syntax:
- *      {PARAM} {argn}={argv}[(;{argv})*][,{argn2}={argv2}....
- * 
- * In some situations we want to add to native parameter another argument
- * value {argv} to already defined argument {argn} - in this case we have
- * to merge, with ';' char, both definitions because second definition of
- * argument {argn} would overwrite ther first one.
- *
- * In this function, native string is modified without additional memory
- * allocation. It's size (native_size) should be big enough to hold
- * merged parameters, or error will be returned.
- *
- * Return pointer to final string, or NULL if error occured.
- */
-static
-char* smc_pbs_merge_param_(char *native, size_t native_size,
-		const char *param, const char *argn, const char *argv,
-		insert_string_ft insert_f, void *data) {
-	char *p_start;
-	char *result = NULL;
-	char buf[128];
-
-	if ((p_start = strstr(native, param))) {
-		size_t i = 0;
-		char *p_end = 0;
-		char *arg_start = 0;
-
-		// shift after param
-		p_start += strlen(param);
-		i = p_start - native;
-
-		// consume spaces
-		for (; *p_start && *p_start == ' '; ++i, ++p_start);
-
-		// find end of param parameter group
-		for (p_end = p_start; *p_end && *p_end != ' '; ++i, ++p_end);
-		
-		snprintf(buf, sizeof(buf), "%s=", argn);
-		
-		if ((arg_start = strstr(p_start, buf)) && arg_start < p_end) {
-			// found 'argn' string in param group
-			// insert ";{argv}"
-			snprintf(buf, sizeof(buf), ";%s", argv);
-
-			// find end of param string
-			i = arg_start - native;
-			for (; *arg_start && *arg_start != ' ' && *arg_start != ','; ++i, ++arg_start);
-
-			result = insert_f(native, native_size, i, buf, data);
-		} else {
-			// there is no param_string in group - add extp to group
-			// insert at p_end ",x={argv}"
-			snprintf(buf, sizeof(buf), ",%s=%s ", argn, argv);
-
-			result = insert_f(native, native_size, i, buf, data);
-		}
-	} else {
-		snprintf(buf, sizeof(buf), " %s %s=%s ", param, argn, argv);
-
-		result = insert_f(native, native_size, strlen(native), buf, data);
-	}
-
-	return result;
-}
-
-
-/**
- * Insert substring into string by shifting chars in original.
- *
- * Return pointer to original string with inserted substring, or NULL if
- * there is no space in original string.
- */
-static
-char* insert_string_move(char *str, size_t str_size, size_t pos, const char *substr, void *data __attribute__((unused))) {
-	// ensure the space is enough
-	if (strlen(str) + strlen(substr) > str_size)
-		return NULL;
-
-	// make space for new string
-	memmove(str + pos + strlen(substr), str + pos, strlen(str) - pos + 1);
-
-	// insert new string
-	strncpy(str + pos, substr, strlen(substr));
-
-	return str;
-}
-
-
-/**
- * Insert substring into string by realocating memory.
- *
- * Return pointer to new allocated memory for final string.
- */
-static
-char* insert_string_extend(char *str, size_t str_size __attribute__((unused)), size_t pos, const char *substr, void *data) {
-	char *result;
-	sm_alloc_tracked_t tracked = (sm_alloc_tracked_t)data;
-
-	result = sm_alloc_tracked_malloc(tracked, strlen(str) + strlen(substr) + 1);
-
-	strncpy(result, str, pos);
-	strncpy(result + pos, substr, strlen(substr));
-	strcpy(result + pos + strlen(substr), str + pos);
-
-	return result;
-}
-
-
-static
-char* smc_pbs_merge_param(char *native, size_t native_size, const char *param,
-		const char *argn, const char *argv) {
-	return smc_pbs_merge_param_(native, native_size, param, argn, argv,
-			insert_string_move, NULL);
-
-}
-
-
-static
-char* smc_pbs_merge_param_realloc(sm_alloc_tracked_t tracked, const char *native,
-		const char *param, const char *argn, const char *argv) {
-	return smc_pbs_merge_param_((char*)native, 0, param, argn, argv,
-			insert_string_extend, tracked);
-}
-
-
-#endif /* __SMC_PBS_ARGS_H */
Index: trunk/src/common/extensions.c
===================================================================
--- trunk/src/common/extensions.c	(revision 338)
+++ trunk/src/common/extensions.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/common/extensions_internal.h
===================================================================
--- trunk/src/common/extensions_internal.h	(revision 338)
+++ trunk/src/common/extensions_internal.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_EXTENSIONS_INTERNAL_H
Index: trunk/src/common/python_module.c
===================================================================
--- trunk/src/common/python_module.c	(revision 338)
+++ trunk/src/common/python_module.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <string.h>
Index: trunk/src/common/common.c
===================================================================
--- trunk/src/common/common.c	(revision 338)
+++ trunk/src/common/common.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/common/python_module.h
===================================================================
--- trunk/src/common/python_module.h	(revision 338)
+++ trunk/src/common/python_module.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_PYTHON_H
Index: trunk/src/common/common.h
===================================================================
--- trunk/src/common/common.h	(revision 338)
+++ trunk/src/common/common.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_COMMON_H
Index: trunk/src/modules/wd_sandboxing/wd_sandboxing.c
===================================================================
--- trunk/src/modules/wd_sandboxing/wd_sandboxing.c	(revision 338)
+++ trunk/src/modules/wd_sandboxing/wd_sandboxing.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <stdio.h>
@@ -42,5 +35,5 @@
 static int setup(sm_module_t);
 static void cleanup(sm_module_t);
-static sm_value_t *handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params);
+static sm_value_t *handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
 
 SM_GENERAL_MODULE = {
@@ -86,5 +79,5 @@
 
 static sm_value_t *
-handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params)
+handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
 {
 	sm_alloc_tracked_t mh;
@@ -157,5 +150,5 @@
 	sm_alloc_tracked_free(&mh);
 
-	signal_h->stop_emission(signal_h);
+	signal->stop_emission(signal);
 
 	if (result)
Index: trunk/src/modules/qcg_comp_client/Makefile.am
===================================================================
--- trunk/src/modules/qcg_comp_client/Makefile.am	(revision 61)
+++ trunk/src/modules/qcg_comp_client/Makefile.am	(revision 1)
@@ -35,6 +35,5 @@
 	     schemas/jsdl.xsd \
 	     schemas/qcg-comp-rsync.wsdl \
-	     schemas/qcg-comp-socks.wsdl \
-             schemas/qcg-comp-monitoring.xsd
+	     schemas/qcg-comp-socks.wsdl
 	     
 
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-ares.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-ares.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/qcg-comp-ares.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-ares.wsdl
+link ../../../../schemas/interface/smoa-comp-ares.wsdl
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-staging.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-staging.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/qcg-comp-staging.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-staging.wsdl
+link ../../../../schemas/interface/smoa-comp-staging.wsdl
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-factory.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-factory.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-factory.xsd
+link ../../../../schemas/interface/smoa-comp-factory.xsd
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-rsync.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-rsync.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/qcg-comp-rsync.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-rsync.wsdl
+link ../../../../schemas/interface/smoa-comp-rsync.wsdl
Index: trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-ares.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-ares.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/jsdl-qcg-comp-ares.xsd
+link ../../../../schemas/interface/jsdl-smoa-comp-ares.xsd
Index: trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-staging.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-staging.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-staging.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/jsdl-qcg-comp-staging.xsd
+link ../../../../schemas/interface/jsdl-smoa-comp-staging.xsd
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-ares.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-ares.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-ares.xsd
+link ../../../../schemas/interface/smoa-comp-ares.xsd
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-socks.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-socks.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/qcg-comp-socks.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-socks.wsdl
+link ../../../../schemas/interface/smoa-comp-socks.wsdl
Index: trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-factory.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-factory.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_client/schemas/jsdl-qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/jsdl-qcg-comp-factory.xsd
+link ../../../../schemas/interface/jsdl-smoa-comp-factory.xsd
Index: trunk/src/modules/qcg_comp_client/schemas/qcg-comp-monitoring.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/schemas/qcg-comp-monitoring.xsd	(revision 60)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../../../schemas/interface/qcg-comp-monitoring.xsd
Index: trunk/src/modules/qcg_comp_client/qcg_comp_client.c
===================================================================
--- trunk/src/modules/qcg_comp_client/qcg_comp_client.c	(revision 338)
+++ trunk/src/modules/qcg_comp_client/qcg_comp_client.c	(revision 1)
@@ -2,22 +2,17 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ *  Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */
 
@@ -288,5 +283,5 @@
 			sm_debug("dom->type = %d", dom->type);
 
-			if (dom->type == SOAP_TYPE__qcf__ActivityId) {
+			if (dom->type == SOAP_TYPE__qcg_comp_factory__ActivityId) {
 				const char *value = (const char *) dom->node;
 				size_t ignore = strlen("urn:uuid:");
@@ -593,5 +588,5 @@
 			if (jsdl_str) {
 				operation_code = OP_CREATE_ACTIVITY;
-				op_namespace = SMC_NAMESPACE_BES_FACTORY "/BESFactoryPortType";
+				op_namespace = SMC_NAMESPACE_BES_FACTORY;
 				op_name = "CreateActivity";
 
@@ -635,5 +630,5 @@
 
 				operation_code = OP_GET_ACTIVITY_STATUS;
-				op_namespace = SMC_NAMESPACE_BES_FACTORY "/BESFactoryPortType";
+				op_namespace = SMC_NAMESPACE_BES_FACTORY;
 				op_name = "GetActivityStatuses";
 			} else if (reservation_id || reservation_epr_file) {
@@ -669,5 +664,5 @@
 
 				operation_code = OP_GET_ACTIVITY_DOC;
-				op_namespace = SMC_NAMESPACE_BES_FACTORY "/BESFactoryPortType";
+				op_namespace = SMC_NAMESPACE_BES_FACTORY;
 				op_name = "GetActivityDocuments";
 			} else if (reservation_id || reservation_epr_file) {
@@ -704,6 +699,6 @@
 
 				operation_code = OP_TERMINATE_ACTIVITY;
-				op_namespace = SMC_NAMESPACE_BES_FACTORY "/BESFactoryPortType";
-				op_name = "TerminateActivities";
+				op_namespace = SMC_NAMESPACE_BES_FACTORY;
+				op_name = "TerminateActivites";
 			} else if (reservation_id || reservation_epr_file) {
 				if (activity_id
@@ -735,5 +730,5 @@
 
 			operation_code = OP_GET_FACTORY_DOC;
-			op_namespace = SMC_NAMESPACE_BES_FACTORY "/BESFactoryPortType";
+			op_namespace = SMC_NAMESPACE_BES_FACTORY;
 			op_name = "GetFactoryAttributesDocument";
 
@@ -752,5 +747,5 @@
 
 			operation_code = OP_DISABLE_SUB;
-			op_namespace = SMC_NAMESPACE_BES_MANAGEMENT "/BESManagementPortType";
+			op_namespace = SMC_NAMESPACE_BES_MANAGEMENT;
 			op_name = "StopAcceptingNewActivities";
 
@@ -769,5 +764,5 @@
 
 			operation_code = OP_ENABLE_SUB;
-			op_namespace = SMC_NAMESPACE_BES_MANAGEMENT "/BESManagementPortType";
+			op_namespace = SMC_NAMESPACE_BES_MANAGEMENT;
 			op_name = "StartAcceptingNewActivities";
 
@@ -804,5 +799,5 @@
 			operation_code = OP_STAGE_IN;
 			op_namespace = SMC_NAMESPACE_STAGING;
-			op_name = "StageFilesIn";
+			op_name = "StageIn";
 			break;
 		}
@@ -820,5 +815,5 @@
 			operation_code = OP_STAGE_OUT;
 			op_namespace = SMC_NAMESPACE_STAGING;
-			op_name = "StageFilesOut";
+			op_name = "StageOut";
 			break;
 		}
@@ -871,5 +866,5 @@
 			operation_code = OP_MKDIR;
 			op_namespace = SMC_NAMESPACE_STAGING;
-			op_name = "MkDir";
+			op_name = "MkDirFile";
 			break;
 		}
@@ -955,6 +950,4 @@
 	activity_doc.jsdl__JobDefinition = &jsdl;
 	request.bes_factory__ActivityDocument = &activity_doc;
-	
-	soap_default_jsdl__JobDefinition_USCOREType(NULL, &jsdl);
 
 	handle = sm_gsoap_buffer_get(jsdl_str, &jsdl, jsdl__JobDefinition_USCOREType, NULL, qcgcomp_namespaces);
@@ -967,11 +960,10 @@
 	/* remove non-protocol DS elements */
 	for ( i = jsdl.jsdl__JobDescription->__sizeDataStaging - 1; i>=0; i--) {
-		struct jsdl__DataStaging_USCOREType ds = jsdl.jsdl__JobDescription->jsdl__DataStaging[i];
-
-		if ((ds.jsdl__Source && ds.jsdl__Source->jsdl__URI && !strchr(ds.jsdl__Source->jsdl__URI, ':'))
-			|| (ds.jsdl__Target && ds.jsdl__Target->jsdl__URI && !strchr(ds.jsdl__Target->jsdl__URI, ':'))) {
+		struct jsdl__DataStaging_USCOREType *ds = jsdl.jsdl__JobDescription->jsdl__DataStaging + i;
+
+		if ((ds->jsdl__Source && ds->jsdl__Source->jsdl__URI && !strchr(ds->jsdl__Source->jsdl__URI, ':'))
+			|| (ds->jsdl__Target && ds->jsdl__Target->jsdl__URI && !strchr(ds->jsdl__Target->jsdl__URI, ':'))) {
 			if (i != jsdl.jsdl__JobDescription->__sizeDataStaging - 1) {
-				jsdl.jsdl__JobDescription->jsdl__DataStaging[i] = 
-					jsdl.jsdl__JobDescription->jsdl__DataStaging[jsdl.jsdl__JobDescription->__sizeDataStaging - 1];
+				ds[i] = ds[jsdl.jsdl__JobDescription->__sizeDataStaging - 1];
 			}
 
@@ -987,14 +979,6 @@
 		jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation =
 			sm_alloc_tracked_malloc(tracked, sizeof(*jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation));
-		
-		memset(jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation, 0, 
-			sizeof(*jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation));
-		
-		jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier =
-			sm_alloc_tracked_malloc(tracked, sizeof(*jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier));
-		
-
-
-		if ((handle2 = create_reservation_epr(jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier)) == NULL)
+
+		if ((handle2 = create_reservation_epr(&jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier)) == NULL)
 			goto fault;
 	}
@@ -1103,20 +1087,20 @@
 		if (response.Response[0].bes_factory__ActivityStatus->__union_ActivityStatusType) {
 			switch (response.Response[0].bes_factory__ActivityStatus->__union_ActivityStatusType) {
-				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Stage_in:
+				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Stage_in:
 					status = "Stage-in";
 					break;
-				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Stage_out:
+				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Stage_out:
 					status = "Stage-out";
 					break;
-				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Executing:
+				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Executing:
 					status = "Executing";
 					break;
-				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Queued:
+				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Queued:
 					status = "Queued";
 					break;
-				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Held:
+				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Held:
 					status = "Held";
 					break;
-				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Suspended:
+				case SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Suspended:
 					status = "Suspended";
 					break;
@@ -1128,7 +1112,7 @@
 		}
 
-		if (response.Response[0].bes_factory__ActivityStatus->qcf__ActivityEndStatus &&
-			response.Response[0].bes_factory__ActivityStatus->qcf__ActivityEndStatus->ExitStatus) {
-			printf("status = %s (exit status = %d)\n", status, (int)*(response.Response[0].bes_factory__ActivityStatus->qcf__ActivityEndStatus->ExitStatus));
+		if (response.Response[0].bes_factory__ActivityStatus->qcg_comp_factory__ActivityEndStatus &&
+			response.Response[0].bes_factory__ActivityStatus->qcg_comp_factory__ActivityEndStatus->ExitStatus) {
+			printf("status = %s (exit status = %d)\n", status, (int)*(response.Response[0].bes_factory__ActivityStatus->qcg_comp_factory__ActivityEndStatus->ExitStatus));
 		} else {
 			printf("status = %s\n", status);
@@ -1193,5 +1177,5 @@
 
 		if (extra_info) {
-			printf("\nLocal job ID: %s\n", response.Response[0].qcf__LocalActivityId);
+			printf("\nLocal job ID: %s\n", response.Response[0].qcg_comp_factory__LocalActivityId);
 		}
 
Index: trunk/src/modules/qcg_comp_client/qcg-comp-monitoring.xsd
===================================================================
--- trunk/src/modules/qcg_comp_client/qcg-comp-monitoring.xsd	(revision 60)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../../schemas/interface/qcg-comp-monitoring.xsd
Index: trunk/src/modules/bat_updater/Makefile.am
===================================================================
--- trunk/src/modules/bat_updater/Makefile.am	(revision 1)
+++ trunk/src/modules/bat_updater/Makefile.am	(revision 1)
@@ -0,0 +1,18 @@
+# $Id: Makefile.am 2626 2009-08-05 23:46:29Z mmamonski $
+
+noinst_LTLIBRARIES = libactivemqcpp.la
+moduleexec_LTLIBRARIES = bat_updater.la 
+
+libactivemqcpp_la_CPPFLAGS = $(LIBACTIVEMQ_CPP_CPPFLAGS)
+libactivemqcpp_la_SOURCES = activemqcpp.cpp activemqcpp.h
+libactivemqcpp_la_LIBADD = $(LIBACTIVEMQ_CPP_LIBS)
+
+bat_updater_la_SOURCES = bat_updater.c 
+bat_updater_la_CPPFLAGS = \
+			    -DSM_MODULE \
+			    -I$(top_srcdir)/src \
+			    $(QCG_CORE_CPPFLAGS) 
+
+
+bat_updater_la_LIBADD = $(QCG_CORE_LIBS) libactivemqcpp.la
+bat_updater_la_LDFLAGS = -module -avoid-version -rpath $(moduleexecdir)
Index: trunk/src/modules/bat_updater/bat_updater.c
===================================================================
--- trunk/src/modules/bat_updater/bat_updater.c	(revision 1)
+++ trunk/src/modules/bat_updater/bat_updater.c	(revision 1)
@@ -0,0 +1,442 @@
+/* $Id: notification_wsn.c 122 2010-06-09 14:10:00Z mamonski $ */
+
+/*
+ *  Copyright 2006-2010 QCG Project Team
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+
+#include <qcg-core/sm.h>
+#include <qcg-core/conf.h>
+#include <qcg-core/client.h>
+#include <qcg-core/logger.h>
+#include <qcg-core/string.h>
+#include <qcg-core/signal.h>
+#include <qcg-core/thread.h>
+#include <qcg-core/uuid.h>
+#include <qcg-core/xmalloc.h>
+#include <qcg-core/modules/modules.h>
+#include <qcg-core/modules/general_module.h>
+#include <qcg-core/modules/ntf_client.h>
+
+#include <activemqcpp.h>
+
+#include <pwd.h>
+#include <grp.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+
+__SM_ID("$Id$");
+
+#define SMC_BAT_MESSAGE_TEMPLATE    "\n<?xml version=\"1.0\" encoding=\"UTF-8\"?> <site name=\"%s\"> \n\
+   <job>\n\
+        \t<batch_server>%s</batch_server>\n\
+        \t<job_id>%s</job_id>\n\
+        \t<user>%s</user>\n\
+        \t<group>%s</group>\n\
+%s\
+        \t<queue>%s</queue>\n\
+        \t<ctime>%d</ctime>\n\
+        \t<qtime>%d</qtime>\n\
+        \t<etime>%d</etime>\n\
+        \t<start>%d</start>\n\
+        \t<end>%d</end>\n\
+        \t<exec_host>\n%s\
+        \t</exec_host>\n\
+        \t<cputime>%d</cputime>\n\
+        \t<walltime>%d</walltime>\n\
+        \t<mem>%d</mem>\n\
+        \t<vmem>%d</vmem>\n\
+        \t<estatus>%d</estatus>\n\
+        \t<infrastructure>%s</infrastructure>\n\
+        \t<grid_job_id>\"%s\"</grid_job_id>\n\
+        \t<userDN>\"%s\"</userDN>\n\
+    </job>\n\
+</site>"
+
+#define SMC_BAT_NODE_TEMPLATE    "\t\t<node>\n\
+		\t<nodename>%s</nodename>\n\
+		\t<cpu>%s</cpu>\n\
+		</node>\n"
+
+#define SMC_BAT_ACCOUNT_TEMPLATE "\t\t<account>%s</account>\n"
+
+/*
+ *
+example message taken from https://wiki.plgrid.pl/doku.php?id=pakiet3:bat:report-protocol
+<site name="CYFRONET-LCG2">
+    <job>
+        <batch_server>batch.cyf-kr.edu.pl</batch_server> -> gethostname ()
+        <job_id>1233</job_id> OK
+        <user>plguser</user> OK
+        <group>plggroup</group> from <user> -> getpwnam_r() -> getgrgid_r() 
+        <account>nazwa_grantu</account> -> from JSDL (project)
+        <queue>plgrid</queue> TODO rusage:queue
+        <ctime>1258745240</ctime>
+        <qtime>1258745240</qtime>
+        <etime>1258745240</etime> ctime = qtime = etime
+        <start>1258745241</start> OK
+        <end>1258745364</end> OK
+        <exec_host> TODO : nodes
+        <node>
+            <nodename>pl-wn001</nodename>
+            <cpu>0</cpu>
+        </node>
+                <node>
+            <nodename>pl-wn002</nodename>
+            <cpu>1</cpu>
+        </node>
+        </exec_host>
+        <cputime>39</cputime> CHECK:rusage
+        <walltime>120</walltime> end - start TODO: add walltime in rusage (what if job was suspended)
+        <mem>4000</mem> CHECK:rusage
+        <vmem>20000</vmem> TODO:rusage
+        <estatus>0</estatus> OK
+        <infrastructure>glite</infrastructure> OK -> "qcg"
+        <vo>plgrid</vo> SKIP
+        <grid_job_id>"https://lb.grid.cyf-kr.edu.pl:9000/0fCVRLjzwGfO1TGQA7HX1g"</grid_job_id> OK
+        <userDN>"/C=PL/O=GRID/O=Cyfronet/CN=Wojciech Ziajka"</userDN> OK
+        <userFQAN>"/vo.plgrid.pl/grant1/Role=NULL/Capability=NULL"</userFQAN> SKIP
+    </job>
+</site>
+*/
+
+static int setup(sm_module_t);
+static void cleanup(sm_module_t);
+static int connect(void);
+
+static sm_value_t *handle_finished(sm_signal_t, sm_value_t *, const sm_value_t *);
+
+
+static const char *bat_service_url = NULL;
+static const char *site_name = NULL;
+static const char *queue_name = NULL;
+static char hostname[4096] = "";
+
+static const char * url = NULL;
+
+#define MAX_RETRY 8
+#define SUSPEND_TIME 3600
+#define CONNECTION_TIMEOUT 4000
+static unsigned connect_retry = 0;
+static time_t down_time = 0;
+static int connected = 0;
+
+SM_GENERAL_MODULE = {
+	.header = {
+		.entry_size = SM_GENERAL_MODULE_ENTRY_SIZE,
+		.api_type = SM_API_GENERAL,
+
+		.name = "bat_updater",
+		.descr = "PL-Grid accounting module",
+
+		.version_major = 0,
+		.version_minor = 1,
+
+		.setup = setup,
+		.cleanup = cleanup,
+
+		.multiple_instances_supported = SM_FALSE
+	}
+};
+
+int
+connect()
+{
+	time_t temp_time = time(NULL);
+
+	if(connect_retry == MAX_RETRY && down_time != 0 && temp_time - down_time >= SUSPEND_TIME) {
+		connect_retry = 0;
+		down_time = 0;
+		sm_info("Setting connect_retry to 0");
+	}	
+
+	if(url == NULL)
+	{
+		if((url = sm_asprintf("%s?soConnectTimeout=%d",bat_service_url,CONNECTION_TIMEOUT)) == NULL)
+		{
+			sm_error("Memory allocation wasn't possible");
+			return 2;
+		}
+		sm_info("Connecting using URL: %s",url);
+	}
+
+	if(connect_retry < MAX_RETRY && activemqcpp_connect(url, queue_name) == 0) { 
+		sm_info("ActiveMQ connected to %s, queue: %s", bat_service_url, queue_name); 
+		connect_retry = 0;
+		return 0;
+	} else if (connect_retry < MAX_RETRY) {
+		connect_retry++;
+		sm_info("Connect retry: %d/%d\n",connect_retry,MAX_RETRY); //
+		sm_error("Failed to connect to  %s, queue: %s", bat_service_url, queue_name);
+		return 1;
+	} else if (connect_retry == MAX_RETRY && down_time == 0) {
+		down_time = time(NULL);
+		sm_error("BAT service marked as down");
+		return 2;
+	} else {
+		return 2;
+	}	
+}
+
+int
+setup(sm_module_t this)
+{
+	SM_DEBUG_ENTER();
+
+	if (sm_signal_connect("smc_job_finished", handle_finished) == SM_FAULT) {
+		sm_error("Failed to connect to smc_job_finished signal");
+		return SM_FAULT;
+	}
+
+	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:BATServiceURL", &bat_service_url) != SM_OK) {
+		sm_error("Failed to read BATServiceURL");
+		return SM_FAULT;
+	}
+
+	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:SiteName", &site_name) != SM_OK) {
+		sm_error("Failed to read SiteName");
+		return SM_FAULT;
+	}
+
+	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:QueueName", &queue_name) != SM_OK) {
+		sm_error("Failed to read QueueName");
+		return SM_FAULT;
+	}
+
+	/* hostname */
+	if(gethostname(hostname, sizeof(hostname)) == -1) { 
+		sm_perror("gethostname() failed/");
+		return SM_FAULT;
+	} else {
+		sm_info("batch_server = %s",hostname);
+	}
+
+	sm_info("BAT Service URL = %s", bat_service_url);
+	sm_info("Site name       = %s", site_name);
+	sm_info("Queue name      = %s", queue_name);
+	sm_info("Batch server    = %s", hostname);
+
+	connected = connect();	
+	return SM_OK;
+}
+
+
+
+
+
+void
+cleanup(sm_module_t this sm_unused)
+{
+	SM_DEBUG_ENTER();
+
+	if( connected == 0 && activemqcpp_disconnect() == 0) { 
+		sm_info("ActiveMQ: disconnected"); 
+	}
+	else {	
+		sm_error("ActiveMQ: could not disconnect"); 
+	}
+
+	sm_free(url);
+}	
+
+
+sm_value_t *
+handle_finished(sm_signal_t sig sm_unused, sm_value_t *params, const sm_value_t *previous sm_unused)
+{
+	static char * temp_xml = NULL;
+
+ 	struct passwd pd;
+  	struct passwd *tempPwdPtr = NULL;
+	char pwdbuffer[4096] = "";
+
+	struct group grp;
+ 	struct group *tempGrpPtr = NULL;
+  	char grpbuffer[4096] = "";
+  	
+	char *temp_exec_host = "";
+	char *temp_exec_host_old = NULL;
+	char *temp_nodename = NULL;
+	char *temp_node = NULL;
+	char *temp_cpu = NULL;
+	char *ptr = NULL;
+	char *temp_ptr = NULL;
+	char *rest = NULL;
+	char *token = NULL;
+	char *account = NULL;
+
+	if(connected != 0)
+	{
+		sm_info("Trying to reconnect before sending msg");
+		if((connected = connect()) != 0)
+		{
+			sm_error("Can't connect to BAT server");
+			return SM_VALUE_NONE_SINGLETON;
+		}
+	}
+
+	SM_DEBUG_ENTER_STR(params[0]->vstring);
+
+	sm_info("grid_job_id = %s", params[0]->vstring);
+	{
+		char *p = strchr(params[1]->vstring, '.');
+		/* remove submission host from job id*/
+		if (p)
+			*p = '\0';
+
+	}
+	sm_info("job_id = %s", params[1]->vstring);
+	sm_info("user_dn = %s", params[5]->vstring); 
+	sm_info("user = %s", params[6]->vstring);
+	sm_info("ctime=qtime=etime = %d", params[7]->vint32); 
+	sm_info("start = %d", params[8]->vint32);
+	sm_info("end = %d", params[9]->vint32);
+	sm_info("estatus = %d", params[10]->vint32);
+	sm_info("cputime = %f", params[11]->vdouble);
+	sm_info("mem = %f", params[12]->vdouble); 
+	sm_info("vmem = %f", params[13]->vdouble);
+	sm_info("infrastructure = qcg"); 	
+	sm_info("queue = %s", params[14]->vstring);
+	sm_info("project = %s", params[15]->vstring);
+	sm_info("walltime = %d", params[16]->vint32);
+	sm_info("nodes = %s", params[17]->vstring);
+	sm_info("jsdl = %s", params[4]->vstring);
+	 
+ 	/* group */
+	if ((getpwnam_r(params[6]->vstring, &pd, pwdbuffer, sizeof(pwdbuffer), &tempPwdPtr))!=0 || tempPwdPtr == NULL) {
+     		sm_perror("getpwnam_r() failed.");
+		goto end;
+	}
+
+	sm_debug("group id: %d",pd.pw_gid);	
+	if ((getgrgid_r(pd.pw_gid,&grp,grpbuffer,sizeof(grpbuffer),&tempGrpPtr))!=0 || tempGrpPtr == NULL) {
+		sm_perror("getgrgid_r() error.");
+		goto end;
+	} else {
+		sm_info("group = %s", grp.gr_name);
+ 	}
+
+	/* exec_host */
+	ptr = sm_strdup(params[17]->vstring);
+	do
+	{
+		token = strtok_r(ptr, "/", &rest);
+		if (token == NULL)
+		{
+			sm_error("Illegal exec_host format: %s", params[17]->vstring);
+			goto end;
+		}
+
+		temp_nodename = sm_strdup(token);
+
+		if (ptr!=NULL)
+		{
+			temp_ptr = ptr;
+			ptr = NULL;
+	    	}
+
+		token = strtok_r(NULL, "+", &rest);
+
+		if (token == NULL)
+		{
+			sm_error("Illegal exec_host format: %s", params[17]->vstring);
+			goto end;
+		}
+
+		temp_cpu = sm_strdup(token);
+
+		if ((temp_node = sm_asprintf(SMC_BAT_NODE_TEMPLATE,temp_nodename,temp_cpu)) == NULL) { 
+			sm_error("Memory allocation wasn't possible");
+			goto end;
+		}
+
+		sm_free(temp_nodename);
+		sm_free(temp_cpu); 
+
+		temp_exec_host_old = sm_strdup(temp_exec_host);
+
+		if (strcmp(temp_exec_host, "") != 0) {		
+			sm_free(temp_exec_host);
+		}
+
+		if ((temp_exec_host = sm_asprintf("%s%s",temp_exec_host_old,temp_node)) == NULL) {
+			sm_error("Memory allocation wasn't possible");
+			goto end;
+		}
+		sm_free(temp_exec_host_old);
+		
+		sm_free(temp_node);
+	}
+	while( strcmp(rest,"") !=0 );
+	
+	sm_free(temp_ptr);
+	
+	if ( params[15]->vstring ) {
+		account = sm_asprintf(SMC_BAT_ACCOUNT_TEMPLATE, params[15]->vstring);
+	} else {
+		account = sm_strdup("");
+	}
+
+	if ((temp_xml = sm_asprintf(SMC_BAT_MESSAGE_TEMPLATE, 
+		/*site name*/ site_name,
+		/*batch server*/  hostname, 
+		/*job_id*/params[1]->vstring, 
+		/*user*/ params[6]->vstring,
+		/*group*/ grp.gr_name,  
+		/*account*/ account,  
+		/*queue*/ params[14]->vstring, 
+		/*ctime*/ params[7]->vint32, 
+		/*qtime*/ params[7]->vint32, 
+		/*etime*/ params[7]->vint32,  
+		/*start*/ params[8]->vint32,
+		/*end*/ params[9]->vint32,
+		/*exec_host*/ temp_exec_host,
+		/*cpu time*/ (int) params[11]->vdouble, 
+		/*wall time*/ params[16]->vint32,  
+		/*mem*/ (int) params[12]->vdouble, 
+		/*vmem*/ (int) params[13]->vdouble,   
+		/*estatus*/ params[10]->vint32, 
+		/*infrasructure*/ "qcg",  
+		/*grid_job_id*/ params[0]->vstring, 
+		/*userDN*/ params[5]->vstring)) == NULL) {
+		sm_error("Memory allocation wasn't possible");
+		goto end;
+	}
+	
+	sm_info("Sending rusage record: %s", temp_xml);
+
+	if (activemqcpp_send_message(temp_xml) == 0) {
+		sm_info("Usage record successfully sent");
+	} else {	 
+		sm_info("Reconnecting before send");
+		if((connected = connect()) == 0 && activemqcpp_send_message(temp_xml) == 0)
+			sm_info("Usage record successfully sent");
+		else
+			sm_error("Can't send usage record to BAT service");
+	}
+
+	sm_free(temp_exec_host);
+
+end:	
+	sm_free(account);
+	sm_free(temp_xml);
+	return SM_VALUE_NONE_SINGLETON;
+}
+
+
Index: trunk/src/modules/bat_updater/activemqcpp.cpp
===================================================================
--- trunk/src/modules/bat_updater/activemqcpp.cpp	(revision 1)
+++ trunk/src/modules/bat_updater/activemqcpp.cpp	(revision 1)
@@ -0,0 +1,167 @@
+#include <activemqcpp.h>
+
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/CountDownLatch.h>
+#include <decaf/lang/Long.h>
+#include <decaf/util/Date.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/util/Config.h>
+#include <activemq/library/ActiveMQCPP.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/TextMessage.h>
+#include <cms/BytesMessage.h>
+#include <cms/MapMessage.h>
+#include <cms/ExceptionListener.h>
+#include <cms/MessageListener.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <memory>
+
+using namespace activemq;
+using namespace activemq::core;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace cms;
+using namespace std;
+
+static Connection* connection;
+static Session* session;
+static Destination* destination;
+static MessageProducer* producer;
+
+static int cleanup(void);
+
+int activemqcpp_connect(const char  *service_address, const char *queue_name)
+{
+	if(cleanup() == 1 ) /* Sometimes disconnect is not possible so we have to do connect after connect -> cleanup() first */
+		return 1;
+	
+	std::string brokerURI = (string) service_address;
+	activemq::library::ActiveMQCPP::initializeLibrary();
+	try 
+	{
+		auto_ptr<ActiveMQConnectionFactory> connectionFactory(new ActiveMQConnectionFactory( brokerURI  ) );
+		try
+		{
+			connection = connectionFactory->createConnection();
+			connection->start();
+		}
+		catch( CMSException& e ) 
+		{
+			return 1;
+		}
+
+		session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
+		destination = session->createQueue( (string) queue_name );
+		producer = session->createProducer( destination);
+
+	}
+	catch ( CMSException& e ) 
+	{
+		e.printStackTrace();
+		return 1;
+	}
+	return 0;
+}
+
+int activemqcpp_send_message(const char *raw_xml)
+{
+	try
+	{
+		string text = (string) raw_xml;
+		TextMessage* message = session->createTextMessage( text );
+		producer->send( message );
+		delete message;
+	}
+	catch ( CMSException& e ) 
+	{
+		e.printStackTrace();
+		return 1;
+	}
+
+	return 0;
+}
+
+
+int activemqcpp_disconnect()
+{
+	if(cleanup() ==1 )
+		return 1;
+	
+	activemq::library::ActiveMQCPP::shutdownLibrary();
+	return 0;
+}
+
+int cleanup()
+{	
+	try
+	{
+		if( destination != NULL ) 
+		{
+			delete destination;
+			destination = NULL;
+		}
+	} catch ( CMSException& e ) 
+	{ 
+		e.printStackTrace(); 
+		return 1; 
+	}
+	destination = NULL;
+
+	try
+	{
+		if( producer != NULL ) 
+		{
+			delete producer;
+			producer = NULL;
+		}
+	} catch ( CMSException& e ) 
+	{ 
+		e.printStackTrace(); 
+		return 1; 
+	}
+
+	try
+	{
+		if( session != NULL ) 
+			session->close();
+		if( connection != NULL ) 
+			connection->close();
+	} catch ( CMSException& e ) 
+	{ 
+		e.printStackTrace(); 
+		return 1;
+	}
+
+	try
+	{
+		if( session != NULL ) 
+		{
+			delete session;
+			session = NULL;
+		}
+	} catch ( CMSException& e ) 
+	{ 
+		e.printStackTrace(); 
+		return 1;
+	}
+
+	try {
+		if( connection != NULL ) 
+		{
+			delete connection;
+			connection = NULL;
+		}
+	} catch ( CMSException& e ) 
+	{ 
+		e.printStackTrace(); 
+		return 1;
+	}
+
+	return 0;
+}
Index: trunk/src/modules/bat_updater/activemq_server.cpp
===================================================================
--- trunk/src/modules/bat_updater/activemq_server.cpp	(revision 1)
+++ trunk/src/modules/bat_updater/activemq_server.cpp	(revision 1)
@@ -0,0 +1,171 @@
+#include <decaf/lang/Thread.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/CountDownLatch.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/transport/DefaultTransportListener.h>
+#include <activemq/library/ActiveMQCPP.h>
+#include <decaf/lang/Integer.h>
+#include <activemq/util/Config.h>
+#include <decaf/util/Date.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/TextMessage.h>
+#include <cms/BytesMessage.h>
+#include <cms/MapMessage.h>
+#include <cms/ExceptionListener.h>
+#include <cms/MessageListener.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+
+using namespace activemq;
+using namespace activemq::core;
+using namespace activemq::transport;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace cms;
+using namespace std;
+
+class ServerActivemq : public ExceptionListener,
+                            public MessageListener,
+                            public DefaultTransportListener {
+
+	private: 
+		Connection* connection;
+		Session* session;
+		Destination* destination;
+		MessageConsumer* consumer;
+		
+	public:
+	
+		void connect(char  *service_address, char *queue_name)
+		{
+			printf("============ Connect ==========\n");
+			std::string brokerURI = "failover:(" +(string) service_address+ ")";
+			cout << brokerURI << endl;	
+			
+			activemq::library::ActiveMQCPP::initializeLibrary();
+			try 
+			{
+				// Create a ConnectionFactory
+				ActiveMQConnectionFactory* connectionFactory = new ActiveMQConnectionFactory( brokerURI );
+				
+				// Create a Connection
+				connection = connectionFactory->createConnection();
+				delete connectionFactory;
+				
+				ActiveMQConnection* amqConnection = dynamic_cast<ActiveMQConnection*>( connection );
+				if( amqConnection != NULL ) {
+					amqConnection->addTransportListener( this );
+				}
+
+				connection->start();
+				
+				connection->setExceptionListener(this);
+				
+				session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
+
+				destination = session->createQueue( (string) queue_name );
+
+				// Create a MessageConsumer from the Session to the Topic or Queue
+				consumer = session->createConsumer( destination );
+				consumer->setMessageListener( this );
+
+			} catch (CMSException& e) {
+					e.printStackTrace();
+			}
+		}
+		
+		virtual ~ServerActivemq(){
+		}
+
+		void close() {
+			this->disconnect();
+		}
+
+		// Called from the consumer since this class is a registered MessageListener.
+		virtual void onMessage( const Message* message )
+		{
+			static int count = 0;
+
+			try
+			{
+				count++;
+				const TextMessage* textMessage =
+					dynamic_cast< const TextMessage* >( message );
+				string text = "";
+
+				if( textMessage != NULL ) {
+					text = textMessage->getText();
+				} else {
+					text = "NOT A TEXTMESSAGE!";
+				}
+
+				printf( "Message #%d Received: %s\n", count, text.c_str() );
+			} catch (CMSException& e) {
+				e.printStackTrace();
+			}
+		}
+
+		virtual void onException( const CMSException& ex AMQCPP_UNUSED ) {
+			printf("CMS Exception occurred.  Shutting down client.\n");
+			exit(1);
+		}
+
+		virtual void transportInterrupted() {
+			std::cout << "The Connection's Transport has been Interrupted." << std::endl;
+		}
+
+		virtual void transportResumed() {
+			std::cout << "The Connection's Transport has been Restored." << std::endl;
+		}
+		
+	private:
+		void disconnect()
+		{
+			printf("============ Disonnect ==========\n");
+			try{
+				if( destination != NULL ) delete destination;
+			}catch (CMSException& e) {}
+			destination = NULL;
+
+			try{
+				if( consumer != NULL ) delete consumer;
+			}catch (CMSException& e) {}
+			consumer = NULL;
+
+			try{
+				if( session != NULL ) session->close();
+				if( connection != NULL ) connection->close();
+			}catch (CMSException& e) {}
+
+			try{
+				if( session != NULL ) delete session;
+			}catch (CMSException& e) {}
+			session = NULL;
+
+			try{
+				if( connection != NULL ) delete connection;
+			}catch (CMSException& e) {}
+			connection = NULL;
+
+			activemq::library::ActiveMQCPP::shutdownLibrary();
+		}
+};
+
+int main(int argc, char ** argv)
+{
+	printf("============ Program start ============\n");
+ 	ServerActivemq server;
+	server.connect((char *) "tcp://127.0.0.1:61616", (char *)"test-jobs");
+	
+	// Wait to exit.
+    	std::cout << "Press 'q' to quit" << std::endl;
+   	while( std::cin.get() != 'q') {}
+	
+	server.close();
+	printf("============ Program end =============\n");	
+	return 0;
+}
Index: trunk/src/modules/bat_updater/activemqcpp.h
===================================================================
--- trunk/src/modules/bat_updater/activemqcpp.h	(revision 1)
+++ trunk/src/modules/bat_updater/activemqcpp.h	(revision 1)
@@ -0,0 +1,17 @@
+#ifndef __ACTIVEMQCPP_H
+#define __ACTIVEMQCPP_H
+
+#ifdef __cplusplus
+ extern "C" {
+ #endif
+
+ int activemqcpp_connect(const char  *service_address, const char *queue_name);
+ int activemqcpp_send_message(const char *raw_xml);
+ int activemqcpp_disconnect();
+
+#ifdef __cplusplus
+ }
+ #endif
+
+
+#endif /* __ACTIVEMQCPP_H */
Index: trunk/src/modules/qcg_coordinator_service/qcg_coordinator_service.c
===================================================================
--- trunk/src/modules/qcg_coordinator_service/qcg_coordinator_service.c	(revision 338)
+++ trunk/src/modules/qcg_coordinator_service/qcg_coordinator_service.c	(revision 1)
@@ -2,22 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * $Id: qcg_coordinator_service.c 2 2009-10-05 10:09:52Z mamonski $
  */
 
@@ -268,17 +264,16 @@
 	modules = this->module_manager->find_by_api2(this->module_manager, SM_API_ECM, SM_MODULE_SERVICE_MODE);
 
-	for (l = modules; l; l = l->next) {
-		sm_ecm_module_t ecm_module = (sm_ecm_module_t) l->data;
-		ecm_module->add_post_setup_callback((sm_module_t) ecm_module,
-				post_transport_setup_callback, NULL);
-	}
-
-	sm_list_free(modules, SM_FALSE);
+        for (l = modules; l; l = l->next) {
+            sm_ecm_module_t ecm_module = (sm_ecm_module_t) l->data;
+			ecm_module->add_post_setup_callback((sm_module_t) ecm_module, post_transport_setup_callback, NULL);
+        }
+
+	sm_list_free(modules,SM_FALSE);
 
 	remote_coordinator_module = (sm_ecm_client_module_t) this->module_manager->find_by_name_first(this->module_manager, "qcg_coordinator_client");
 	if (!remote_coordinator_module) {
-		sm_error("Failed to find qcg_coordinator_client module");
-		return SM_FAULT;
-	}
+                sm_error("Failed to find qcg_coordinator_client module");
+                return SM_FAULT;
+        }
 
 	return SM_OK;
@@ -326,5 +321,7 @@
 	smc_coordinator_wait_t result;
 
-	if (!(result = sm_malloc(sizeof(*result)))) {
+	result = sm_malloc(sizeof(*result));
+
+	if (result == NULL) {
 		return NULL;
 	}
@@ -337,12 +334,12 @@
 
 static void
-smc_coordinator_wait_signal(smc_coordinator_wait_t wait_h)
-{
-	SM_MANDATORY_P(wait_h);
+smc_coordinator_wait_signal(smc_coordinator_wait_t wait)
+{
+	SM_MANDATORY_P(wait);
 
 	SM_DEBUG_ENTER();
 
-	if (wait_h->active) {
-		sm_cond_signal(&wait_h->cond);
+	if (wait->active) {
+		sm_cond_signal(&wait->cond);
 	}
 
@@ -351,20 +348,20 @@
 
 static void
-smc_coordinator_wait_dispose(smc_coordinator_wait_t wait_h)
-{
-	SM_MANDATORY_P(wait_h);
-
-	wait_h->active = SM_FALSE;
-	sm_list_add(&inactive_wait_objs,wait_h,0);
-}
-
-static void
-smc_coordinator_wait_destroy(smc_coordinator_wait_t* wait_h)
-{
-	SM_MANDATORY_P(wait_h);
-
-	sm_cond_destroy(&(*wait_h)->cond);
-	sm_free(*wait_h);
-	*wait_h = NULL;
+smc_coordinator_wait_dispose(smc_coordinator_wait_t wait)
+{
+	SM_MANDATORY_P(wait);
+
+	wait->active = SM_FALSE;
+	sm_list_add(&inactive_wait_objs,wait,0);
+}
+
+static void
+smc_coordinator_wait_destroy(smc_coordinator_wait_t* wait)
+{
+	SM_MANDATORY_P(wait);
+
+	sm_cond_destroy(&(*wait)->cond);
+	sm_free(*wait);
+	*wait = NULL;
 }
 
@@ -378,7 +375,5 @@
 	SM_DEBUG_ENTER_STR(key_name);
 
-	if (!(key = sm_malloc(sizeof(*key))))
-		return NULL;
-
+	key = sm_malloc(sizeof(*key));
 	key->name = sm_strdup(key_name);
 	key->wait_objs = NULL;
@@ -406,12 +401,12 @@
 static void
 smc_coordinator_key_subscribe(smc_coordinator_key_t key,
-		smc_coordinator_wait_t wait_h)
+		smc_coordinator_wait_t wait)
 {
 	SM_MANDATORY_P(key);
-	SM_MANDATORY_P(wait_h);
+	SM_MANDATORY_P(wait);
 
 	SM_DEBUG_ENTER_PTR(key);
 
-	sm_list_add(&key->wait_objs,wait_h,0);
+	sm_list_add(&key->wait_objs,wait,0);
 }
 
@@ -444,12 +439,12 @@
 	sm_list_t wait_to_remove = NULL;
 	sm_list_t cur;
-	smc_coordinator_wait_t wait_h;
+	smc_coordinator_wait_t wait;
 
 	SM_MANDATORY_P(key);
 
 	for (cur = key->wait_objs; cur; cur = cur->next) {
-		wait_h = (smc_coordinator_wait_t) cur->data;
-		if (!wait_h->active) {
-			sm_list_add(&wait_to_remove, wait_h,0);
+		wait = (smc_coordinator_wait_t) cur->data;
+		if (!wait->active) {
+			sm_list_add(&wait_to_remove,wait,0);
 		}
 	}
@@ -484,6 +479,5 @@
 	SM_MANDATORY_P(key);
 
-	if (!(data = sm_malloc(sizeof(*data))))
-		return NULL;
+	data = sm_malloc(sizeof(*data));
 
 	data->key = key;
@@ -516,7 +510,5 @@
 	SM_MANDATORY_P(key_name);
 
-	if (!(op_get = sm_malloc(sizeof(*op_get))))
-		return NULL;
-
+	op_get = sm_malloc(sizeof(*op_get));
 	op_get->key_name = strdup(key_name);
 	op_get->master_url = (master_url == NULL) ? NULL : strdup(master_url);
@@ -532,7 +524,5 @@
 	SM_MANDATORY_P(op_get);
 
-	if (!(result = sm_malloc(sizeof(*result))))
-		return NULL;
-
+	result = sm_malloc(sizeof(*result));
 	result->key_name = strdup(op_get->key_name);
 	result->master_url = (op_get->master_url == NULL) ? NULL : strdup(op_get->master_url);
@@ -566,7 +556,5 @@
 	SM_MANDATORY_P(key_name);
 
-	if (!(op_put = sm_malloc(sizeof(*op_put))))
-		return NULL;
-
+	op_put = sm_malloc(sizeof(*op_put));
 	op_put->key_name = strdup(key_name);
 	op_put->master_url = (master_url == NULL) ? NULL : sm_strdup(master_url);
@@ -583,7 +571,5 @@
 	SM_MANDATORY_P(op_put);
 
-	if (!(result = sm_malloc(sizeof(*result))))
-		return NULL;
-
+	result = sm_malloc(sizeof(*result));
 	result->key_name = strdup(op_put->key_name);
 	result->master_url = (op_put->master_url == NULL) ? NULL : strdup(op_put->master_url);
@@ -612,7 +598,5 @@
 	smc_coordinator_queue_t queue;
 
-	if (!(queue = sm_malloc(sizeof(*queue))))
-		return NULL;
-
+	queue = sm_malloc(sizeof(*queue));
 	queue->op_get_list = NULL;
 	queue->op_put_list = NULL;
@@ -734,7 +718,5 @@
 	SM_DEBUG_ENTER_STR(master_url);
 
-	if (!(url_thread = sm_malloc(sizeof(*url_thread))))
-		return NULL;
-
+	url_thread = sm_malloc(sizeof(*url_thread));
 	url_thread->manager = manager;
 	url_thread->master_url = sm_strdup(master_url);
@@ -742,5 +724,5 @@
 	sm_mutex_init(&url_thread->lock);
 	url_thread->active = SM_TRUE;
-	sm_thread_create(&url_thread->thread, NULL, smc_coordinator_url_thread_process, url_thread);
+	sm_thread_create(&url_thread->thread,NULL,smc_coordinator_url_thread_process,url_thread);
 	url_thread->client_transport = sm_client_create_transport(remote_coordinator_module);
 	url_thread->_backup_service_url = url_thread->client_transport->service_url;
@@ -847,7 +829,5 @@
 	smc_coordinator_store_t store;
 
-	if (!(store = sm_malloc(sizeof(*store))))
-		return NULL;
-
+	store = sm_malloc(sizeof(*store));
 	store->keys = NULL;
 	store->data = NULL;
@@ -995,6 +975,5 @@
 	SM_DEBUG_ENTER_STR(default_master);
 
-	if (!(manager = sm_malloc(sizeof(*manager))))
-		return NULL;
+	manager = sm_malloc(sizeof(*manager));
 
 	if (default_master) {
@@ -1214,6 +1193,5 @@
 		return transport->fault(transport, &fault);
 
-	if (!(op_put = sm_malloc(sizeof(smc_coordinator_op_put_t) * size)))
-		goto out;
+	op_put = sm_malloc(sizeof(smc_coordinator_op_put_t) * size);
 
 	for (i = 0; i < size; i++) {
@@ -1242,5 +1220,4 @@
 	}
 
-out:
 	sm_free(op_put);
 
@@ -1359,8 +1336,5 @@
 
 		result_list_size = sm_list_count(result_list);
-
-		if (!(*result = sm_malloc(sizeof(smc_coordinator_data_t) * result_list_size)))
-			return SM_FAULT;
-
+		*result = sm_malloc(sizeof(smc_coordinator_data_t) * result_list_size);
 		*result_size = result_list_size;
 
@@ -1408,7 +1382,7 @@
 
 	if (transport != NULL) {
-		res = transport->transport_malloc(transport, sizeof(struct qcgcoordinator__ProcessData)); /* CHECKED */
+		res = transport->transport_malloc(transport, sizeof(struct qcgcoordinator__ProcessData));
 	} else {
-		res = sm_malloc(sizeof(struct qcgcoordinator__ProcessData)); /* CHECKED */
+		res = sm_malloc(sizeof(struct qcgcoordinator__ProcessData));
 	}
 
@@ -1420,11 +1394,7 @@
 
 	if (transport != NULL) {
-		res->items = transport->transport_malloc(transport, sizeof(struct qcgcoordinator__StringVector) * size); /* CHECKED */
+		res->items = transport->transport_malloc(transport, sizeof(struct qcgcoordinator__StringVector) * size);
 	} else {
-		res->items = sm_malloc(sizeof(struct qcgcoordinator__StringVector) * size); /* CHECKED */
-	}
-
-	if (!res->items) {
-		return NULL;
+		res->items = sm_malloc(sizeof(struct qcgcoordinator__StringVector) * size);
 	}
 
@@ -1486,6 +1456,6 @@
 	time_t t;
 	smc_coordinator_op_get_t* op_get;
-	int res_size = 0;
-	smc_coordinator_data_t* data = NULL;
+	int res_size;
+	smc_coordinator_data_t* data;
 
 	if (transport->enter(transport, GET_OP_TOKEN, &fault) != SM_OK)
@@ -1497,6 +1467,5 @@
 
 	t = (timeout == NULL ? (unsigned) get_request_timeout : *timeout);
-	if (!(op_get = sm_malloc(sizeof(smc_coordinator_op_get_t) * size)))
-		goto out;
+	op_get = sm_malloc(sizeof(smc_coordinator_op_get_t) * size);
 
 	for (i = 0; i < size; i++) {
@@ -1515,7 +1484,7 @@
 	}
 
-out:
-	SM_FREE(op_get);
-	SM_FREE(data);
+
+	sm_free(op_get);
+	sm_free(data);
 
 	return transport->exit(transport, NULL);
@@ -1574,10 +1543,5 @@
 	}
 
-	if (!(entries = sm_calloc(size, sizeof(smc_coordinator_process_entry_t)))) {
-		smc_coordinator_url_thread_unlock(url_thread);
-		sm_debug("make_get Unlocked thread");
-		return;
-	}
-
+	entries = sm_malloc(sizeof(smc_coordinator_process_entry_t) * size);
 	for (i = 0, cur = url_thread->queue->op_get_list; i < size; i++, cur = cur->next) {
 		op_get = (smc_coordinator_op_get_t) cur->data;
@@ -1661,10 +1625,5 @@
 	}
 
-	if (!(entries = sm_malloc(sizeof(smc_coordinator_process_entry_t) * size))) {
-		smc_coordinator_url_thread_unlock(url_thread);
-		sm_debug("make_put Unlocked thread");
-		return;
-	}
-
+	entries = sm_malloc(sizeof(smc_coordinator_process_entry_t) * size);
 	for (i = 0, cur = url_thread->queue->op_put_list; i < size; i++, cur = cur->next) {
 		op_put = (smc_coordinator_op_put_t) cur->data;
@@ -1744,10 +1703,10 @@
 {
 	sm_list_t cur;
-	smc_coordinator_wait_t wait_h;
+	smc_coordinator_wait_t wait;
 
 	cur = inactive_wait_objs;
 	while (cur != NULL) {
-		wait_h = (smc_coordinator_wait_t) cur->data;
-		smc_coordinator_wait_destroy(&wait_h);
+		wait = (smc_coordinator_wait_t) cur->data;
+		smc_coordinator_wait_destroy(&wait);
 		cur = cur->next;
 	}
Index: trunk/src/modules/submission_drmaa/submission_drmaa.c
===================================================================
--- trunk/src/modules/submission_drmaa/submission_drmaa.c	(revision 1109)
+++ trunk/src/modules/submission_drmaa/submission_drmaa.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <sys/types.h>
@@ -38,5 +31,4 @@
 #include <include/submission_module.h>
 #include <include/namespaces.h>
-#include <include/pbs_args.h>
 #include <xmlstructs/xmlstructs.h>
 
@@ -45,12 +37,6 @@
 #define NATIVE_SPECIFICATION_ARID_GE      "-ar "
 #define NATIVE_SPECIFICATION_ARID_LSF     "-U "
-/* Full parameter would be "-W x=FLAGS:ADVRES:" but in case of '-W' we must merge
- * all arguments into one */
-#define NATIVE_SPECIFICATION_ARID_TORQUE  "FLAGS:ADVRES:"
-#define NATIVE_SPECIFICATION_ARID_PBSPRO  "-q "
-#define NATIVE_SPECIFICATION_ARID_SLURM   "--reservation="
-#define NATIVE_SPECIFICATION_ARID_LL      "@ll_res_id="
-#define DEFAULT_MAUI_SCHEDULING_INTERVAL   (30)
-#define MAUI_SCHEDULING_INTERVAL_ENV      "MAUI_SCHEDULING_INTERVAL"
+#define NATIVE_SPECIFICATION_ARID_TORQUE  "-W x=FLAGS:ADVRES:"
+#define MAUI_SCHEDUL_INTERVAL             (30)
 
 static SM_BOOL warn_if_no_transfer_support = SM_TRUE;
@@ -64,5 +50,4 @@
 static sm_value_t *submission_drmaa_get_statuses(sm_module_t, sm_value_t *);
 static sm_value_t *submission_drmaa_wait(sm_module_t);
-static sm_value_t *submission_drmaa_wait_single(sm_module_t, sm_value_t *);
 static sm_value_t *submission_drmaa_get_drms(sm_module_t);
 
@@ -92,5 +77,4 @@
 	.get_statuses = submission_drmaa_get_statuses,
 	.wait = submission_drmaa_wait,
-	.wait_single = submission_drmaa_wait_single,
 	.get_drms = submission_drmaa_get_drms
 };
@@ -109,8 +93,10 @@
 #define SET_ERRBUF() \
 	do { \
+		char __buf[64]; \
 		if (!strlen(errbuf)) \
 			strlcpy(errbuf, drmaa_strerror(ret), sizeof(errbuf)); \
 		remove_newlines(errbuf); \
-		sm_notice("%s (DRMAA errno = %d)", errbuf, ret); \
+		snprintf(__buf, sizeof(__buf), " (DRMAA errno = %d)", ret); \
+		strlcat(errbuf, __buf, sizeof(errbuf)); \
 	} while (0)
 
@@ -143,9 +129,5 @@
 	sm_debug("refresh_waited_jobs_period = %d", refresh_waited_jobs_period);
 
-  #ifdef RTLD_DEEPBIND
-	handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND);
-  #else
 	handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
-  #endif
 	if (!handle) {
 		const char *msg = dlerror();
@@ -220,13 +202,7 @@
 		drms = SUBMISSION_DRMS_TORQUE;
 		drms_ns = sm_asprintf("%s/%s", SMC_NAMESPACE_DRMS_TORQUE, drms_string);
-	} else if (strstr(drms_string, "PBSPro") || strstr(drms_string, "PBS-Pro")) {
+	} else if (strstr(drms_string, "PBSPro")) {
 		drms = SUBMISSION_DRMS_PBSPRO;
 		drms_ns = sm_asprintf("%s/%s", SMC_NAMESPACE_DRMS_PBSPRO, drms_string);
-	} else if (strstr(drms_string, "SLURM")) {
-		drms = SUBMISSION_DRMS_SLURM;
-		drms_ns = sm_asprintf("%s/%s", SMC_NAMESPACE_DRMS_SLURM, drms_string);
-	} else if (strstr(drms_string, "LoadLeveler")) {
-		drms = SUBMISSION_DRMS_LL;
-		drms_ns = sm_asprintf("%s/%s", SMC_NAMESPACE_DRMS_LL, drms_string);
 	} else {
 		drms = SUBMISSION_DRMS_UNKNOWN;
@@ -336,5 +312,5 @@
 
 static drmaa_job_template_t *
-jsdl_to_drmaa_job_template(const char *jsdlstr, const char *arid, int arduration, char **wd,  sm_value_t **result)
+jsdl_to_drmaa_job_template(const char *jsdlstr, const char *arid, int arduration, sm_value_t **result)
 {
 	char errbuf[DRMAA_ERROR_STRING_BUFFER] = "";
@@ -355,5 +331,4 @@
 	SM_MANDATORY_P(jsdlstr);
 	SM_MANDATORY_P(result);
-	SM_MANDATORY_P(wd);
 
 	SM_DEBUG_ENTER_STR(jsdlstr);
@@ -401,19 +376,5 @@
 		if ((tmp = jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_factory__JobCategory))
 			SM_TRY_NOT(job_category = sm_alloc_tracked_strdup(tracked, tmp));
-
-		if (jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation &&
-				jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->LocalReservationIdentifier) {
-
-			if (arid) {
-				sm_error("Both Local and global reservation identifier set");
-				goto fault;
-			}
-
-			arid = jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->LocalReservationIdentifier;
-			arduration = -1;
-		}
-
-	}
-
+	}
 
 	if (arid) {
@@ -424,38 +385,10 @@
 		else if (drms == SUBMISSION_DRMS_LSF)
 			option = NATIVE_SPECIFICATION_ARID_LSF;
-		else if (drms == SUBMISSION_DRMS_PBSPRO)
-			option = NATIVE_SPECIFICATION_ARID_PBSPRO;
-		else if (drms == SUBMISSION_DRMS_SLURM)
-			option = NATIVE_SPECIFICATION_ARID_SLURM;
 		else if (drms == SUBMISSION_DRMS_TORQUE) {
-			int maui_scheduling_interval = DEFAULT_MAUI_SCHEDULING_INTERVAL;
-
-			if (getenv(MAUI_SCHEDULING_INTERVAL_ENV))
-				maui_scheduling_interval = (int)strtol(getenv(MAUI_SCHEDULING_INTERVAL_ENV), NULL, 10);
-
-			if (maui_scheduling_interval <=0 )
-				sm_error("Invalid value of " MAUI_SCHEDULING_INTERVAL_ENV ". Using default value = %d", DEFAULT_MAUI_SCHEDULING_INTERVAL);
-
-			/* be on safe side */
-			maui_scheduling_interval *= 2;
-
 			/* make Torque + maui to behave simlar to the LSF and SGE */
-			if (arduration != -1) {
-				char *p = NULL;
-				if (native_spec && (p=strstr(native_spec, "-l walltime="))) {
-					sm_info("Erasing previously set walltime: %s", p);
-					p[2]='_'; /*small trick - to "eat" also space between -l and walltime */
-					while (*p != '\0' && !isspace(*p)) {
-						*p = ' ';
-						p++;
-					}
-				}
-				SM_TRY_NOT(native_spec = sm_alloc_tracked_asprintf(tracked, "%s -l walltime=%u", (native_spec ? native_spec : ""), (arduration > maui_scheduling_interval ? arduration - maui_scheduling_interval : arduration) ));
-			}
-
-			native_spec = smc_pbs_merge_param_realloc(tracked, native_spec, "-W", "x", sm_alloc_tracked_asprintf(tracked, "%s%s", NATIVE_SPECIFICATION_ARID_TORQUE, arid));
-			option = NULL;
-		} else if (drms == SUBMISSION_DRMS_LL) {
-			option = NATIVE_SPECIFICATION_ARID_LL;
+			if (!native_spec || !strstr(native_spec, "walltime"))
+				SM_TRY_NOT(native_spec = sm_alloc_tracked_asprintf(tracked, "%s -l walltime=%u", (native_spec ? native_spec : ""), (arduration > MAUI_SCHEDUL_INTERVAL ? arduration - MAUI_SCHEDUL_INTERVAL : arduration) ));
+
+			option = NATIVE_SPECIFICATION_ARID_TORQUE;
 		} else {
 			sm_notice("Cannot request Advance Reservation. Unsupported DRM system.");
@@ -463,6 +396,5 @@
 		}
 
-		if (option)
-			SM_TRY_NOT(native_spec = sm_alloc_tracked_asprintf(tracked, "%s %s%s", (native_spec ? native_spec : ""), option, arid));
+		SM_TRY_NOT(native_spec = sm_alloc_tracked_asprintf(tracked, "%s%s %s", option, arid, (native_spec ? native_spec : "")));
 	}
 
@@ -480,15 +412,4 @@
 
 	if (jsdl.jsdl__JobDescription->jsdl__JobIdentification && (tmp = jsdl.jsdl__JobDescription->jsdl__JobIdentification->jsdl__JobName)) {
-		for (i = 0; i < (int)strlen(tmp); i++) {
-			if (!isalnum(tmp[i]) && tmp[i] != '_')
-				tmp[i] = '_';
-		}
-
-		if (strlen(tmp) && !isalpha(tmp[0]))
-			tmp[0] = 'J';
-
-		if (strlen(tmp) > 15)
-			tmp[15] = '\0';
-
 		sm_debug("Setting DRMAA_JOB_NAME: \"%s\"", tmp);
 		if ((ret = drmaa_set_attribute(jt, DRMAA_JOB_NAME, tmp, errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
@@ -553,6 +474,10 @@
 		if ((ret = drmaa_set_attribute(jt, DRMAA_OUTPUT_PATH, output, errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
 			goto fault;
-	}
- 
+	} else {
+		sm_debug("Setting DRMAA_OUTPUT_PATH to /dev/null");
+		if ((ret = drmaa_set_attribute(jt, DRMAA_OUTPUT_PATH, ":/dev/null", errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
+			goto fault;
+	}
+
 	if (app->jsdl_hpcpa__Error) {
 		char *error;
@@ -571,17 +496,29 @@
 		if ((ret = drmaa_set_attribute(jt, DRMAA_ERROR_PATH, error, errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
 			goto fault;
-	}
+	} else {
+		sm_debug("Setting DRMAA_ERROR_PATH to /dev/null");
+		if ((ret = drmaa_set_attribute(jt, DRMAA_ERROR_PATH, ":/dev/null", errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
+			goto fault;
+	}
+
+	/* transfering files to execution files is useless as almost EVERY productive cluster has shared file system : TODO: make it configurable
+	if (transfer_files_supported) {
+		if (strlen(transfer_files)) {
+			sm_debug("Setting DRMAA_TRANSFER_FILES: \"%s\"", transfer_files);
+			if ((ret = drmaa_set_attribute(jt, DRMAA_TRANSFER_FILES, transfer_files, errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
+				goto fault;
+		}
+	} else {
+		if (warn_if_no_transfer_support)
+			sm_notice("DRMAA implementation does not support requesting file transfer from/to submit/execution host");
+	}*/
 
 	if (working_dir) {
 		sm_debug("Setting DRMAA_WD: \"%s\"", working_dir);
-
 		if ((ret = drmaa_set_attribute(jt, DRMAA_WD, working_dir, errbuf, sizeof(errbuf) - 1)) != DRMAA_ERRNO_SUCCESS)
 			goto fault;
-
-		*wd = sm_strdup(working_dir);
-	} else {
-		*wd = NULL;
-	}
-
+	}
+
+	/* XXX: GFD.133 says that it's 1/0 for DRMAA_BLOCK_EMAIL and y/n for DRMAA_JOIN_FILES */
 	(void) drmaa_set_attribute(jt, DRMAA_BLOCK_EMAIL, "1", errbuf, sizeof(errbuf) - 1);
 
@@ -645,5 +582,4 @@
 	const char *arid = NULL;
 	unsigned int arduration = 0;
-	char *wd = NULL;
 
 	SM_MANDATORY_P(this);
@@ -661,5 +597,5 @@
 	}
 
-	if (!(jt = jsdl_to_drmaa_job_template(params[0]->vstring, arid, arduration, &wd, &result)))
+	if (!(jt = jsdl_to_drmaa_job_template(params[0]->vstring, arid, arduration, &result)))
 		goto fault;
 
@@ -675,5 +611,5 @@
 	switch (ret) {
 		case DRMAA_ERRNO_SUCCESS:
-			sm_info("Submitted job: %s (wd=%s)", jobid, SM_SAFE_STR(wd));
+			sm_info("Submitted job: %s", jobid);
 			result = sm_value_create(2, SM_VALUE_RET_CODE, SUBMISSION_OK, SM_VALUE_STRING, jobid);
 			break;
@@ -697,5 +633,4 @@
 
 	drmaa_delete_job_template(jt, errbuf, sizeof(errbuf) - 1);
-	sm_free(wd);
 	return result;
 
@@ -703,5 +638,4 @@
 	if (jt)
 		drmaa_delete_job_template(jt, errbuf, sizeof(errbuf) - 1);
-	sm_free(wd);
 	if (result && !SM_VALUE_RET_CODE_OK(result[0]))
 		return result;
@@ -810,5 +744,5 @@
 			switch (ps) {
 				case DRMAA_PS_UNDETERMINED:
-					/* XXX: Ugh, ugly! But what else can we do? - TODO Return last DB state*/
+					/* XXX: Ugh, ugly! But what else can we do? */
 					sm_debug("DRMAA_PS_UNDETERMINED (%d)", undetermined_tries);
 					if (undetermined_tries++ > 5) {
@@ -861,5 +795,5 @@
 
 static sm_value_t *
-submission_drmaa_wait_internal(sm_module_t this, const char* waited_job_id, int wait_timeout)
+submission_drmaa_wait(sm_module_t this)
 {
 	char jobid[DRMAA_JOBNAME_BUFFER] = "";
@@ -875,6 +809,6 @@
 	SM_DEBUG_ENTER();
 
-	if ((ret = drmaa_wait(waited_job_id, jobid, sizeof(jobid) - 1, &status, wait_timeout, &rusage, errbuf, sizeof(errbuf) - 1)) == DRMAA_ERRNO_EXIT_TIMEOUT)
-		return sm_value_create(1, SM_VALUE_RET_CODE, SUBMISSION_WAIT_TIMEOUT_FAULT); /* make wait "less blocking call" */
+	while ((ret = drmaa_wait(DRMAA_JOB_IDS_SESSION_ANY, jobid, sizeof(jobid) - 1, &status, refresh_waited_jobs_period, &rusage, errbuf, sizeof(errbuf) - 1)) == DRMAA_ERRNO_EXIT_TIMEOUT)
+		continue;
 
 	sm_debug("%d <- drmaa_wait", ret);
@@ -919,5 +853,5 @@
 
 	} else {
-		/* failed, jobid, core_dumped, termsig TODO: use hashmap to store list of cancelled jobs*/
+		/* failed, jobid, core_dumped, termsig */
 
 		SM_TRY_NOT(sm_value_append(&result, 1, SM_VALUE_INT32, SUBMISSION_FAILED));
@@ -938,5 +872,5 @@
 			SM_TRY_NOT(sm_value_append(&result, 2, SM_VALUE_BOOL, SM_FALSE, SM_VALUE_NONE));
 	}
-
+	
 	if (rusage) {
 
@@ -949,5 +883,4 @@
 				if (!sm_value_append(&rusagevalue, 1, SM_VALUE_STRING, buf)) {
 					sm_value_free(&rusagevalue);
-					drmaa_release_attr_values(rusage);
 					goto fault;
 				}
@@ -959,11 +892,8 @@
 			if (rusagevalue && !sm_value_append(&result, 1, SM_VALUE_ARRAY, rusagevalue)) {
 				sm_value_free(&rusagevalue);
-				drmaa_release_attr_values(rusage);
 				goto fault;
 			} else if (!rusagevalue && !sm_value_append(&result, 1, SM_VALUE_NONE)) {
-				drmaa_release_attr_values(rusage);
 				goto fault;
 			}
-			drmaa_release_attr_values(rusage);
 	} else
 		SM_TRY_NOT(sm_value_append(&result, 1, SM_VALUE_NONE));
@@ -980,31 +910,4 @@
 
 static sm_value_t *
-submission_drmaa_wait(sm_module_t this)
-{
-
-	SM_MANDATORY_P(this);
-
-	SM_DEBUG_ENTER();
-
-	return submission_drmaa_wait_internal(this, DRMAA_JOB_IDS_SESSION_ANY, refresh_waited_jobs_period);
-}
-
-static sm_value_t *
-submission_drmaa_wait_single(sm_module_t this, sm_value_t *identifier)
-{
-
-	SM_MANDATORY_P(this);
-	SM_MANDATORY_P(identifier);
-
-	assert(sm_value_count(identifier) == 1);
-	assert(SM_VALUE_IS_STRING(identifier[0]));
-
-	SM_DEBUG_ENTER();
-
-	return submission_drmaa_wait_internal(this, identifier[0]->vstring, DRMAA_TIMEOUT_NO_WAIT);
-}
-
-
-static sm_value_t *
 submission_drmaa_get_drms(sm_module_t this sm_unused)
 {
Index: trunk/src/modules/sge_jsdl_filter/sge_jsdl_filter.c
===================================================================
--- trunk/src/modules/sge_jsdl_filter/sge_jsdl_filter.c	(revision 510)
+++ trunk/src/modules/sge_jsdl_filter/sge_jsdl_filter.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <stdio.h>
@@ -42,5 +35,4 @@
 static void cleanup(sm_module_t);
 static sm_value_t *handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
-static char *pe_name = NULL;
 
 SM_GENERAL_MODULE = {
@@ -71,16 +63,4 @@
 	SM_TRY_FAULT(sm_signal_connect("smc_jsdl_filter", handler));
 
-	if (getenv("QCG_GE_PE_NAME") != NULL)
-		pe_name = sm_strdup(getenv("QCG_GE_PE_NAME"));
-	else
-		pe_name = sm_strdup("make"); /* use default PE */
-
-	if (!pe_name)
-		goto fault;
-
-	sm_info("Using %s as GE Parallel Environment", pe_name);
-
-  smc_extensions_add(SMC_NAMESPACE_EXT_JSDL_TOTAL_CPU_COUNT);
-
 	return SM_OK;
 
@@ -93,9 +73,8 @@
 cleanup(sm_module_t this sm_unused)
 {
-	sm_free(pe_name);
 	SM_DEBUG_ENTER();
 }
 static int
-parse_range(struct jsdl__RangeValue_USCOREType *range, long long *minv, long long *maxv)
+parse_range(struct jsdl__RangeValue_USCOREType *range, int *minv, int *maxv)
 {
 	double min_d = 0;
@@ -141,5 +120,5 @@
 
 static sm_value_t *
-handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params)
+handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
 {
 	sm_alloc_tracked_t mh;
@@ -188,11 +167,11 @@
 
 		if (r->jsdl__TotalCPUCount) {
-			long long min_cpu;
-			long long max_cpu;
+			int min_cpu;
+			int max_cpu;
 
 			if (parse_range(r->jsdl__TotalCPUCount, &min_cpu, &max_cpu) == SM_OK) {
 				char tmp[64];
 
-				snprintf(tmp, 64, " -pe %s %d-%d", pe_name, (int)min_cpu, (int)max_cpu);
+				snprintf(tmp, 64, " -pe make %d-%d", min_cpu, max_cpu);
 				strlcat(native, tmp, sizeof(native));
 				r->jsdl__TotalCPUCount = NULL;
@@ -231,20 +210,4 @@
 			r->jsdl__CPUArchitecture = NULL;
 			modified = SM_TRUE;
-		}
-
-		if (r->jsdl__IndividualCPUTime) {
-			long long min_time = 0;
-			long long max_time = 0;
-
-			if (parse_range(r->jsdl__IndividualCPUTime, &min_time, &max_time) != SM_OK || (min_time != max_time) || (min_time <= 0)) {
-				sm_notice("Invalid IndividualCPUTime value");
-			} else {
-				char tmp[64];
-
-				snprintf(tmp, 64, " -l h_rt=%lld", min_time);
-				strlcat(native, tmp, sizeof(native));
-				r->jsdl__IndividualCPUTime = NULL;
-				modified = SM_TRUE;
-			}
 		}
 
@@ -312,5 +275,5 @@
 	sm_alloc_tracked_free(&mh);
 
-	signal_h->stop_emission(signal_h);
+	signal->stop_emission(signal);
 
 	if (result)
Index: trunk/src/modules/staging_s3/staging_s3.c
===================================================================
--- trunk/src/modules/staging_s3/staging_s3.c	(revision 338)
+++ trunk/src/modules/staging_s3/staging_s3.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <sys/types.h>
Index: trunk/src/modules/atz_ardl_filter/atz_ardl_filter.c
===================================================================
--- trunk/src/modules/atz_ardl_filter/atz_ardl_filter.c	(revision 634)
+++ trunk/src/modules/atz_ardl_filter/atz_ardl_filter.c	(revision 1)
@@ -2,34 +2,20 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-
-
-#include <regex.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <errno.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include <qcg-core/sm.h>
@@ -47,19 +33,12 @@
 __SM_ID("$Id: atz_ardl_filter.c 2 2009-10-05 10:09:52Z mamonski $");
 
-#define GRID_MAPFILE "/etc/grid-security/grid-mapfile"
-#define MAPFILE_LINE_REGEXP     "\"(.+)\"[\t ]+([^\t ]+)[\t ]*"
-#define MAPFILE_LINE_MAXLEN     2048
 
 static int setup(sm_module_t);
 static void cleanup(sm_module_t);
-static sm_value_t *handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params);
-
-static int map_using_grid_ampfile(const char *subject, char **local_user_name);
-static int mapfile_readline(FILE *mapfile_fd, char **remote_subject, char **mappings);
+static sm_value_t *handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
 
 static sm_atz_module_t mapfile_module = NULL;
 static struct sm_transport_s dummy_transport;
 
-static regex_t mapfile_regex;
 
 SM_GENERAL_MODULE = {
@@ -94,9 +73,4 @@
 	mapfile_module = (sm_atz_module_t)this->module_manager->find_by_name_first(this->module_manager, "atz_mapfile");
 
-	if (!mapfile_module && (regcomp(&mapfile_regex, MAPFILE_LINE_REGEXP, REG_EXTENDED | REG_NEWLINE) != 0)) {
-                sm_error("regcomp failed");
-                goto fault;
-	}
-
 	return SM_OK;
 
@@ -109,11 +83,9 @@
 cleanup(sm_module_t this sm_unused)
 {
- 	if (!mapfile_module)
-		   regfree(&mapfile_regex);
 	SM_DEBUG_ENTER();
 }
 
 static sm_value_t *
-handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params)
+handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
 {
 	sm_alloc_tracked_t mh;
@@ -140,17 +112,16 @@
 		&& ardl.ardl__ReservationDescription->ardl__Resources->UserName[0] == '/') {
 		sm_atc_token_t token;
-		char *username = NULL;
 
 		token = sm_atc_token_create(&dummy_transport);
 		token->add(token, SM_ATC_TOKEN_X509_SUBJECT, ardl.ardl__ReservationDescription->ardl__Resources->UserName);
 
-		//TODO refactor... its 2.00 am
-		if (!mapfile_module && map_using_grid_ampfile(ardl.ardl__ReservationDescription->ardl__Resources->UserName,&username) != SM_OK) {
-			result = sm_value_create(2, SM_VALUE_RET_CODE, ARDL_FILTER_INVALID_REQUEST_MESSAGE_FAULT, "Invalid user DN", SM_VALUE_NONE);
-                        sm_atc_token_free(&token);
-                        goto fault;  
-		} 
+		if (!mapfile_module) {
+			sm_emerg("No atz_mapfile module loaded");
+			result = sm_value_create(2, SM_VALUE_RET_CODE, ARDL_FILTER_INTERNAL_FAULT, "No atz_mapfile module loaded", SM_VALUE_NONE);
+			sm_atc_token_free(&token);
+			goto fault;
+		}
 
-		if (mapfile_module && mapfile_module->map_user((sm_module_t)mapfile_module, token) != SM_OK) {
+		if (mapfile_module->map_user((sm_module_t)mapfile_module, token) != SM_OK) {
 			result = sm_value_create(2, SM_VALUE_RET_CODE, ARDL_FILTER_INVALID_REQUEST_MESSAGE_FAULT, "Invalid user DN", SM_VALUE_NONE);
 			sm_atc_token_free(&token);
@@ -158,16 +129,8 @@
 		}
 
-		if (!mapfile_module) {
-			sm_info("ARDL User DN = %s mapped to %s", ardl.ardl__ReservationDescription->ardl__Resources->UserName, username);
+		sm_info("ARDL User DN = %s mapped to %s", ardl.ardl__ReservationDescription->ardl__Resources->UserName, ((sm_user_t )token->mapped_users->data)->username);
 
-			SM_TRY_NOT(ardl.ardl__ReservationDescription->ardl__Resources->UserName = sm_alloc_tracked_strdup(mh, username));
-			SM_FREE(username);
-			modified = SM_TRUE;
-		} else {
-			sm_info("ARDL User DN = %s mapped to %s", ardl.ardl__ReservationDescription->ardl__Resources->UserName, ((sm_user_t )token->mapped_users->data)->username);
-
-			SM_TRY_NOT(ardl.ardl__ReservationDescription->ardl__Resources->UserName = sm_alloc_tracked_strdup(mh, ((sm_user_t )token->mapped_users->data)->username));
-			modified = SM_TRUE;
-		}
+		SM_TRY_NOT(ardl.ardl__ReservationDescription->ardl__Resources->UserName = sm_alloc_tracked_strdup(mh, ((sm_user_t )token->mapped_users->data)->username));
+		modified = SM_TRUE;
 
 		sm_atc_token_free(&token);
@@ -190,5 +153,5 @@
 	sm_alloc_tracked_free(&mh);
 
-	signal_h->stop_emission(signal_h);
+	signal->stop_emission(signal);
 
 	if (result)
@@ -197,98 +160,2 @@
 		return sm_value_create(2, SM_VALUE_RET_CODE, ARDL_FILTER_INTERNAL_FAULT, "Internal fault in application_mapper", SM_VALUE_NONE);
 }
-
-static int
-map_using_grid_ampfile(const char *subject, char **local_user_name)
-{
-        char *mapfile_subject = NULL;
-        char *mapfile_mapping = NULL;
-        FILE *mapfile_fd = NULL;
-
-        SM_MANDATORY_PARAM(subject, SM_FAULT);
-
-        SM_DEBUG_ENTER_STR(subject);
-
-	*local_user_name = NULL;
-
-        if (!(mapfile_fd = fopen(GRID_MAPFILE, "r"))) {
-                sm_perror("fopen");
-                goto fault;
-        }
-
-        sm_debug("Opened mapfile: %s", GRID_MAPFILE);
-
-
-        while (SM_OK == mapfile_readline(mapfile_fd, &mapfile_subject, &mapfile_mapping)) {
-		if (strcmp(mapfile_subject, subject) == 0) {
-                	SM_FREE(mapfile_subject);
-			sm_debug("found mapping: %s -> %s", subject, mapfile_mapping);
-			*local_user_name = mapfile_mapping;
-			break;
-		} else {
-                	SM_FREE(mapfile_subject);
-                	SM_FREE(mapfile_mapping);
-		}
-        }
-
-        fclose(mapfile_fd);
-        mapfile_fd = NULL;
-        if  (*local_user_name != NULL) {
-		return SM_OK;
-	} else {
-		return SM_NEG;
-	}
-fault:
-        if (mapfile_fd)
-                fclose(mapfile_fd);
-
-        return SM_FAULT;
-}
-
-int
-mapfile_readline(FILE *mapfile_fd, char **remote_subject, char **mapping)
-{
-        char buf[MAPFILE_LINE_MAXLEN + 1];
-        regmatch_t pmatch[4];
-
-nextline:
-        if (fgets(buf, sizeof(buf), mapfile_fd)) {
-                char *ptr;
-
-                if ((ptr = strchr(buf, '\r')))
-                        *ptr = '\0';
-                if ((ptr = strchr(buf, '\n')))
-                        *ptr = '\0';
-
-                if (buf[0] == '#' || buf[0] == '\0')
-                        goto nextline;
-
-                if (regexec(&mapfile_regex, buf, 4, pmatch, 0)) {
-                        sm_notice("Ignoring line: \"%s\"", buf);
-                        goto nextline;
-                }
-
-                *remote_subject = sm_malloc(pmatch[1].rm_eo - pmatch[1].rm_so + 2);
-                *mapping = sm_malloc(pmatch[2].rm_eo - pmatch[2].rm_so + 2);
-
-                if (NULL == *remote_subject || NULL == *mapping) {
-                        SM_FREE(*remote_subject);
-                        SM_FREE(*mapping);
-                        return SM_FAULT;
-                }
-
-                buf[pmatch[1].rm_eo] = '\0';
-                strcpy(*remote_subject, buf + pmatch[1].rm_so);
-                buf[pmatch[2].rm_eo] = '\0';
-                strcpy(*mapping, buf + pmatch[2].rm_so);
-
-                sm_debug("Read: |%s|%s|", *remote_subject, *mapping);
-        } else {
-                if (ferror(mapfile_fd)) {
-                        sm_error("fgets failed");
-                        clearerr(mapfile_fd);
-                }
-                return SM_FAULT;
-        }
-
-        return SM_OK;
-}
Index: trunk/src/modules/lsf_jsdl_filter/lsf_jsdl_filter.c
===================================================================
--- trunk/src/modules/lsf_jsdl_filter/lsf_jsdl_filter.c	(revision 338)
+++ trunk/src/modules/lsf_jsdl_filter/lsf_jsdl_filter.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <stdio.h>
@@ -127,5 +120,5 @@
 
 static sm_value_t *
-handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params)
+handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
 {
 	sm_alloc_tracked_t mh;
@@ -277,5 +270,5 @@
 	sm_alloc_tracked_free(&mh);
 
-	signal_h->stop_emission(signal_h);
+	signal->stop_emission(signal);
 
 	if (result)
Index: trunk/src/modules/pbs_jsdl_filter/pbs_jsdl_filter.c
===================================================================
--- trunk/src/modules/pbs_jsdl_filter/pbs_jsdl_filter.c	(revision 1109)
+++ trunk/src/modules/pbs_jsdl_filter/pbs_jsdl_filter.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <stdio.h>
@@ -35,6 +28,4 @@
 
 #include <include/jsdl_filter.h>
-#include <include/namespaces.h>
-#include <include/pbs_args.h>
 #include <xmlstructs/xmlstructs.h>
 
@@ -45,10 +36,4 @@
 static sm_value_t *handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
 
-
-static const char *tcc_expression = NULL;
-static const char *mpi_node_property = NULL;
-static const char *partitions = NULL;
-
-
 SM_GENERAL_MODULE = {
 
@@ -75,17 +60,4 @@
 
 	SM_DEBUG_ENTER();
-
-	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:TCCExpression", &tcc_expression) == SM_FAULT)
-		goto fault;
-
-	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:MPINodeProperty", &mpi_node_property) == SM_FAULT)
-		goto fault;
-
-	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:Partitions", &partitions) == SM_FAULT)
-		goto fault;
-
-	if (tcc_expression) {
-		smc_extensions_add(SMC_NAMESPACE_EXT_JSDL_TOTAL_CPU_COUNT);
-	}
 
 	SM_TRY_FAULT(sm_signal_connect("smc_jsdl_filter", handler));
@@ -148,5 +120,5 @@
 
 static sm_value_t *
-handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params)
+handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
 {
 	sm_alloc_tracked_t mh;
@@ -157,5 +129,4 @@
 	sm_value_t *result = NULL;
 	SM_BOOL modified = SM_FALSE;
-	SM_BOOL multinode = SM_FALSE;
 
 	SM_DEBUG_ENTER();
@@ -174,5 +145,4 @@
 		struct jsdl__Resources_USCOREType *r = jsdl.jsdl__JobDescription->jsdl__Resources;
 		char resources[256] = "";
-		char gpu_resources[64] = "";
 
 		if (r->jsdl_qcg_comp_factory__NativeSpecification)
@@ -186,11 +156,4 @@
 			r->jsdl__CandidateHosts = NULL;
 			modified = SM_TRUE;
-		}
-
-		if (r->jsdl_qcg_comp_factory__GPUSCount) {
-			strlcat(gpu_resources, "gpus=", sizeof(gpu_resources));
-			strlcat(gpu_resources, r->jsdl_qcg_comp_factory__GPUSCount, sizeof(gpu_resources));
-
-			r->jsdl_qcg_comp_factory__GPUSCount = NULL;
 		}
 
@@ -200,21 +163,8 @@
 
 			if (parse_range(r->jsdl__TotalCPUCount, &min_cpu, &max_cpu) == SM_OK && (min_cpu == max_cpu)) {
-				if (min_cpu != 1) {
-					char tmp[64];
-
-					if (tcc_expression)
-						snprintf(tmp, 64, tcc_expression, min_cpu);
-					else
-						snprintf(tmp, 64, " -l procs=%lld", min_cpu);
-
-					strlcat(native, tmp, sizeof(native));
-					multinode = SM_TRUE;
-				}
-
-				if (strlen(gpu_resources)) {
-					strlcat(native, ":", sizeof(native));
-					strlcat(native, gpu_resources, sizeof(native));
-				}
-
+				char tmp[64];
+
+				snprintf(tmp, 64, " -l nodes=%lld", min_cpu);
+				strlcat(native, tmp, sizeof(native));
 				r->jsdl__TotalCPUCount = NULL;
 				modified = SM_TRUE;
@@ -238,18 +188,5 @@
 				r->jsdl__TotalResourceCount = NULL;
 				modified = SM_TRUE;
-				multinode = min_nodes > 1 ? SM_TRUE : SM_FALSE;
-
-				if (strlen(gpu_resources)) {
-					strlcat(native, ":", sizeof(native));
-					strlcat(native, gpu_resources, sizeof(native));
-				}
-
-			}
-		}
-
-		if (multinode && mpi_node_property) {
-			char tmp[64];
-			snprintf(tmp, 64, " -l node_properties=%s ", mpi_node_property);
-			strlcat(native, tmp, sizeof(native));
+			}
 		}
 
@@ -343,28 +280,4 @@
 		}
 
-		if (r->jsdl_qcg_comp_factory__ConsumableResources) {
-			if (strlen(resources)) {
-				strlcat(resources,",", sizeof(resources));
-			}
-
-			strlcat(resources, "custom_resources=", sizeof(resources));
-			strlcat(resources, r->jsdl_qcg_comp_factory__ConsumableResources, sizeof(resources));
-
-			r->jsdl_qcg_comp_factory__ConsumableResources = NULL;
-			modified = SM_TRUE;
-		}
-
-		if (r->jsdl_qcg_comp_factory__NodeProperties) {
-			if (strlen(resources)) {
-				strlcat(resources,",", sizeof(resources));
-			}
-
-			strlcat(resources, "node_properties=", sizeof(resources));
-			strlcat(resources, r->jsdl_qcg_comp_factory__NodeProperties, sizeof(resources));
-
-			r->jsdl_qcg_comp_factory__NodeProperties = NULL;
-			modified = SM_TRUE;
-		}
-
 		if (strlen(resources)) {
 			strlcat(native, " -l ", sizeof(native));
@@ -381,13 +294,4 @@
 	}
 
-	if (partitions != NULL) {
-		char tmp[128];
-
-		snprintf(tmp, 128, "PARTITION:%s", partitions);
-
-		smc_pbs_merge_param(native, sizeof(native), "-W", "x", tmp);
-
-		modified = SM_TRUE;
-	}
 
 	if (modified) {
@@ -417,9 +321,9 @@
 	sm_alloc_tracked_free(&mh);
 
-	signal_h->stop_emission(signal_h);
+	signal->stop_emission(signal);
 
 	if (result)
 		return result;
 	else
-		return sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_INTERNAL_FAULT, "Internal fault in LSF JSDL module", SM_VALUE_NONE);
+		return sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_INTERNAL_FAULT, "Internal fault in lsf JSDL module", SM_VALUE_NONE);
 }
Index: trunk/src/modules/application_mapper/application_mapper.c
===================================================================
--- trunk/src/modules/application_mapper/application_mapper.c	(revision 1109)
+++ trunk/src/modules/application_mapper/application_mapper.c	(revision 1)
@@ -2,28 +2,20 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-
-
 #include <stdio.h>
-#include <time.h>
 
 #include <qcg-core/sm.h>
@@ -32,5 +24,4 @@
 #include <qcg-core/signal.h>
 #include <qcg-core/xmalloc.h>
-#include <qcg-core/thread.h>
 #include <qcg-core/modules/modules.h>
 
@@ -42,15 +33,12 @@
 __SM_ID("$Id: application_mapper.c 41 2009-12-22 11:21:20Z mamonski $");
 
-unsigned int appfile_lifetime = 300;
-time_t last_reload = 0;
-
 static int setup(sm_module_t);
 static void cleanup(sm_module_t);
-
-static int load_appfile(const char *app_filename);
-
 static sm_value_t *handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
 static sm_value_t *handle_factory_attributes(sm_signal_t, sm_value_t *, const sm_value_t *);
 
+
+static char applications_xml[65536] = "";
+static SM_BOOL truncated = SM_FALSE;
 
 SM_GENERAL_MODULE = {
@@ -77,15 +65,8 @@
 	char *name;
 	char *version;
-	char *native;
 } *application_mapping_t;
 
-static sm_list_t map_list = NULL;
-static sm_alloc_tracked_t handle = NULL;
-char *application_map_file = NULL;
-static sm_mutex_t module_lock = SM_MUTEX_INITIALIZER;
-
-static char applications_xml[65536] = "";
-static SM_BOOL truncated = SM_FALSE;
-static SM_BOOL initialized = SM_FALSE;
+static sm_list_t map_list;
+static sm_alloc_tracked_t handle;
 
 static void append_str(const char *str)
@@ -96,187 +77,9 @@
 static int
 setup(sm_module_t this)
-{
-
-	SM_DEBUG_ENTER();
-
-	if (initialized)
-		return SM_OK;
-	
-	initialized = SM_TRUE;
-
-
-	SM_TRY_NOT_OK(sm_conf_node_strdup(this->conf_ctxt, SM_FALSE, "/conf:ApplicationMapFile", &application_map_file));
-	sm_conf_node_uint(this->conf_ctxt, SM_FALSE, "/conf:ApplicationMapFileLifetime", &appfile_lifetime);
-	sm_debug("application_map_file = %s", application_map_file);
-	sm_debug("application_map_file_lifetime = %us", appfile_lifetime);
-
-	SM_TRY_FAULT(sm_signal_connect("smc_jsdl_filter", handler));
-	SM_TRY_FAULT(sm_signal_connect("smc_factory_attributes", handle_factory_attributes));
-
-	SM_TRY_NOT_OK(load_appfile(application_map_file));
-
-	last_reload = time(NULL);
-
-	return SM_OK;
-fault:
-	sm_error("Could not initialize application mapper module");
-	return SM_FAULT;
-}
-
-static void
-cleanup(sm_module_t this sm_unused)
-{
-	SM_DEBUG_ENTER();
-
-	sm_alloc_tracked_free(&handle);
-	sm_list_free(map_list, SM_FALSE);
-	sm_free(application_map_file);
-}
-
-static sm_value_t *
-handler(sm_signal_t signal_h, sm_value_t *params, const sm_value_t *chained_params)
-{
-	sm_alloc_tracked_t mh;
-	_jsdl__JobDefinition jsdl;
-	const char *input_jsdl;
-	char *output_jsdl;
-	sm_value_t *result = NULL;
-
-	SM_DEBUG_ENTER();
-
-	sm_mutex_lock(&module_lock);
-
-	if (sm_previous_signal_failed(chained_params))
-		return sm_value_clone(chained_params);
-	else if (sm_signal_first(chained_params))
-		input_jsdl = params[0]->vstring;
-	else
-		input_jsdl = chained_params[1]->vstring;
-
-
-	SM_TRY_NOT(mh = sm_gsoap_buffer_get(input_jsdl, &jsdl, jsdl__JobDefinition_USCOREType, "jsdl:JobDefinition", xmlstructs_namespaces));
-
-	if (jsdl.jsdl__JobDescription->jsdl__Application &&
-		jsdl.jsdl__JobDescription->jsdl__Application->jsdl__ApplicationName) {
-
-		const char *appname = jsdl.jsdl__JobDescription->jsdl__Application->jsdl__ApplicationName;
-		const char *appversion = jsdl.jsdl__JobDescription->jsdl__Application->jsdl__ApplicationVersion;
-		const char *executable = NULL;
-		_jsdl_hpcpa__HPCProfileApplication *hpcpa = NULL;
-		sm_list_t l;
-
-		if (time(NULL) - last_reload >= appfile_lifetime) {
-			sm_debug("Forcing reload of application mapfile");
-			(void)load_appfile(NULL);
-			last_reload = time(NULL);
-		}
-			
-		sm_debug("looking for application entry [%s] [%s]", appname, appversion);
-
-		for (l = map_list; l; l = l->next) {
-			application_mapping_t map = l->data;
-
-			sm_debug("checking application entry [%s] [%s] [%s]", map->name, map->version, map->path);
-
-			if (sm_stricmp(map->name, appname))
-				continue;
-
-			sm_debug("Found application entry [%s] [%s] [%s]", map->name, map->version, map->path);
-
-			// application without version
-			if (appversion == NULL) {
-				// found default entry
-				if (!sm_strcmp(map->version, "*")) {
-					sm_debug("Found default entry - finishing");
-
-					executable = map->path;
-					break;
-				}
-
-				// save first entry for this application, but look further
-				if (executable == NULL) {
-					sm_debug("saving entry - looking further");
-					executable = map->path;
-				}
-			} else if (!sm_stricmp(appversion, map->version)) {
-				// found exact version
-				sm_debug("found exact entry - finishing");
-				executable = map->path;
-				break;
-			}
-		}
-		
-		if (!executable) {
-			char *errmsg = sm_asprintf("The specified Application: %s (version=%s) is not known", appname, (appversion ? appversion : "ANY"));
-			sm_notice("No matching entry found for ApplicationName = %s, ApplicationVersion = %s", appname, SM_SAFE_STR(appversion));
-
-			/* There is no appropriate fault in BES specification
-			 * for failures like these... */
-
-			result = sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_INVALID_REQUEST_MESSAGE_FAULT, errmsg, SM_VALUE_NONE);
-			SM_FREE(errmsg);
-			goto fault;
-		}
-
-		sm_debug("ApplicationName resolved to: %s", executable);
-
-		hpcpa = jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication;
-
-		if (!hpcpa) {
-			SM_TRY_NOT(jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication = sm_alloc_tracked_malloc(mh, sizeof(struct jsdl_hpcpa__HPCProfileApplication_USCOREType)));
-			hpcpa = jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication;
-		}
-
-		hpcpa->jsdl_hpcpa__Executable = sm_alloc_tracked_malloc(mh, sizeof(struct jsdl_hpcpa__FileName_USCOREType));
-		hpcpa->jsdl_hpcpa__Executable->__item = (char *) executable;
-
-		SM_TRY_NOT(output_jsdl = sm_gsoap_buffer_put(&jsdl, jsdl__JobDefinition_USCOREType, "jsdl:JobDefinition", xmlstructs_namespaces));
-
-		result = sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_OK, SM_VALUE_STRING, output_jsdl);
-		SM_FREE(output_jsdl);
-		SM_TRY_NOT(result);
-
-	} else
-		SM_TRY_NOT(result = sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_OK, SM_VALUE_STRING, input_jsdl));
-
-	sm_mutex_unlock(&module_lock);
-	sm_alloc_tracked_free(&mh);
-	return result;
-
-fault:
-	sm_mutex_unlock(&module_lock);
-	sm_alloc_tracked_free(&mh);
-
-	signal_h->stop_emission(signal_h);
-
-	if (result)
-		return result;
-	else
-		return sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_INTERNAL_FAULT, "Internal fault in application_mapper", SM_VALUE_NONE);
-}
-
-sm_value_t *
-handle_factory_attributes(sm_signal_t sig, sm_value_t * drms_type, const sm_value_t *chain)
-{
-	SM_DEBUG_ENTER();
-  (void)sig;
-  (void)drms_type;
-  (void)chain;
-
-	sm_mutex_lock(&module_lock);
-
-	/* try to reload appfile: best effort call */
-	(void)load_appfile(NULL);
-
-	sm_mutex_unlock(&module_lock);
-
-	return sm_value_create(1, SM_VALUE_STRING, applications_xml);
-}
-
-static int load_appfile(const char *app_filename)
 {
 	char path[1024];
 	char name[1024];
 	char version[1024];
+	const char *application_map_file = NULL;
 	FILE *f = NULL;
 	int count = 0;
@@ -286,14 +89,6 @@
 	SM_DEBUG_ENTER();
 
-	if (map_list != NULL) {
-		sm_alloc_tracked_free(&handle);
-
-		sm_list_free(map_list, SM_FALSE);
-		map_list = NULL;
-	}
-
-	if (!app_filename) {
-		app_filename = application_map_file;
-	}
+	SM_TRY_NOT_OK(sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:ApplicationMapFile", &application_map_file));
+	sm_debug("application_map_file = %s", application_map_file);
 
 	SM_TRY_NOT(handle = sm_alloc_tracked_create());
@@ -305,6 +100,4 @@
 	}
 
-	applications_xml[0] = '\0';
-
 	append_str("<smcf:Applications xmlns:smcf='" SMC_NAMESPACE_FACTORY "'>");
 	while (fgets(line, sizeof(line), f)) {
@@ -315,5 +108,4 @@
 		if (sscanf(line, "%s %s %s", name, version, path) != 3)
 			continue;
-
 
 		SM_TRY_NOT(map = sm_alloc_tracked_malloc(handle, sizeof(*map)));
@@ -351,4 +143,8 @@
 	fclose(f);
 
+	SM_TRY_FAULT(sm_signal_connect("smc_jsdl_filter", handler));
+	SM_TRY_FAULT(sm_signal_connect("smc_factory_attributes", handle_factory_attributes));
+
+
 	return SM_OK;
 
@@ -356,8 +152,115 @@
 	if (f)
 		fclose(f);
-
+	if (map) {
+		SM_FREE(map->name);
+		SM_FREE(map->path);
+		SM_FREE(map->version);
+		SM_FREE(map);
+	}
 	sm_alloc_tracked_free(&handle);
 	sm_list_free(map_list, SM_FALSE);
-	map_list = NULL;
 	return SM_FAULT;
 }
+
+static void
+cleanup(sm_module_t this sm_unused)
+{
+	SM_DEBUG_ENTER();
+
+	sm_alloc_tracked_free(&handle);
+	sm_list_free(map_list, SM_FALSE);
+}
+
+static sm_value_t *
+handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
+{
+	sm_alloc_tracked_t mh;
+	_jsdl__JobDefinition jsdl;
+	const char *input_jsdl;
+	char *output_jsdl;
+	sm_value_t *result = NULL;
+
+	SM_DEBUG_ENTER();
+
+	if (sm_previous_signal_failed(chained_params))
+		return sm_value_clone(chained_params);
+	else if (sm_signal_first(chained_params))
+		input_jsdl = params[0]->vstring;
+	else
+		input_jsdl = chained_params[1]->vstring;
+
+	SM_TRY_NOT(mh = sm_gsoap_buffer_get(input_jsdl, &jsdl, jsdl__JobDefinition_USCOREType, "jsdl:JobDefinition", xmlstructs_namespaces));
+
+	if (jsdl.jsdl__JobDescription->jsdl__Application &&
+		jsdl.jsdl__JobDescription->jsdl__Application->jsdl__ApplicationName) {
+
+		const char *appname = jsdl.jsdl__JobDescription->jsdl__Application->jsdl__ApplicationName;
+		const char *appversion = jsdl.jsdl__JobDescription->jsdl__Application->jsdl__ApplicationVersion;
+		const char *executable = NULL;
+		_jsdl_hpcpa__HPCProfileApplication *hpcpa = NULL;
+		sm_list_t l;
+
+		for (l = map_list; l; l = l->next) {
+			application_mapping_t map = l->data;
+
+			if (sm_strcmp(map->name, appname))
+				continue;
+
+			sm_debug("Found application entry");
+
+			if (appversion == NULL || !sm_strcmp(appversion, map->version) || !sm_strcmp(map->version, "*")) {
+				executable = map->path;
+				break;
+			}
+		}
+
+		if (!executable) {
+			sm_notice("No matching entry found for ApplicationName = %s, ApplicationVersion = %s", appname, SM_SAFE_STR(appversion));
+
+			/* There is no appropriate fault in BES specification
+			 * for failures like these... */
+			result = sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_INVALID_REQUEST_MESSAGE_FAULT, "The specified JSDL Application is not known", SM_VALUE_NONE);
+			goto fault;
+		}
+
+		sm_debug("ApplicationName resolved to: %s", executable);
+
+		hpcpa = jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication;
+
+		if (!hpcpa) {
+			SM_TRY_NOT(jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication = sm_alloc_tracked_malloc(mh, sizeof(struct jsdl_hpcpa__HPCProfileApplication_USCOREType)));
+			hpcpa = jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication;
+		}
+
+		hpcpa->jsdl_hpcpa__Executable = sm_alloc_tracked_malloc(mh, sizeof(struct jsdl_hpcpa__FileName_USCOREType));
+		hpcpa->jsdl_hpcpa__Executable->__item = (char *) executable;
+
+		SM_TRY_NOT(output_jsdl = sm_gsoap_buffer_put(&jsdl, jsdl__JobDefinition_USCOREType, "jsdl:JobDefinition", xmlstructs_namespaces));
+
+		result = sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_OK, SM_VALUE_STRING, output_jsdl);
+		SM_FREE(output_jsdl);
+		SM_TRY_NOT(result);
+
+	} else
+		SM_TRY_NOT(result = sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_OK, SM_VALUE_STRING, input_jsdl));
+
+	sm_alloc_tracked_free(&mh);
+	return result;
+
+fault:
+	sm_alloc_tracked_free(&mh);
+
+	signal->stop_emission(signal);
+
+	if (result)
+		return result;
+	else
+		return sm_value_create(2, SM_VALUE_RET_CODE, JSDL_FILTER_INTERNAL_FAULT, "Internal fault in application_mapper", SM_VALUE_NONE);
+}
+
+sm_value_t *
+handle_factory_attributes(sm_signal_t sig, sm_value_t * drms_type, const sm_value_t *chain)
+{
+
+	return sm_value_create(1, SM_VALUE_STRING, applications_xml);
+}
Index: trunk/src/modules/qcg_comp_service/db.c
===================================================================
--- trunk/src/modules/qcg_comp_service/db.c	(revision 338)
+++ trunk/src/modules/qcg_comp_service/db.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/modules/qcg_comp_service/qcg_comp_socks_server.h
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_socks_server.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_socks_server.h	(revision 1)
@@ -1,23 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifndef QCG_COMP_SOCKS_SERVER_H
 #define QCG_COMP_SOCKS_SERVER_H
Index: trunk/src/modules/qcg_comp_service/ardl.h
===================================================================
--- trunk/src/modules/qcg_comp_service/ardl.h	(revision 153)
+++ trunk/src/modules/qcg_comp_service/ardl.h	(revision 1)
@@ -2,19 +2,17 @@
 
 /*
- * QosCosGrid Notification
- * Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+ *  Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */
 
Index: trunk/src/modules/qcg_comp_service/rsvn.c
===================================================================
--- trunk/src/modules/qcg_comp_service/rsvn.c	(revision 664)
+++ trunk/src/modules/qcg_comp_service/rsvn.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <ctype.h>
@@ -74,5 +67,4 @@
 	char *subject;
 	char *mapped_user;
-	char *nodes;
 	struct tm submission_time;
 	struct tm start_time;
@@ -97,5 +89,4 @@
 
 	bool terminated;
-	unsigned int  slots_count;
 } *smc_concrete_rsvn_t;
 
@@ -113,16 +104,16 @@
 
 static const char *insert_txt = "INSERT INTO reservations (id, drms_id,"
-	"submitted_ardl, ardl, subject, mapped_user, submission_time, start_time, end_time, nodes)"
-	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+	"submitted_ardl, ardl, subject, mapped_user, submission_time, start_time, end_time)"
+	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
 static const char *update_txt = "UPDATE reservations SET id = ?, drms_id = ?,"
 	"submitted_ardl = ?, ardl = ?, subject = ?, mapped_user = ?,"
-	"submission_time = ?, start_time = ?, end_time = ?, nodes = ? WHERE id = ?";
+	"submission_time = ?, start_time = ?, end_time = ? WHERE id = ?";
 
 static const char *delete_txt = "DELETE FROM reservations WHERE id = ?";
 
 static const char *insert_acc_txt = "INSERT INTO reservations_acc (id, drms_id,"
-	"submitted_ardl, ardl, subject, mapped_user, submission_time, start_time, end_time, nodes)"
-	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+	"submitted_ardl, ardl, subject, mapped_user, submission_time, start_time, end_time)"
+	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
 static const char *count_txt = "SELECT count(*) FROM reservations";
@@ -160,5 +151,4 @@
 static struct tm smc_rsvn_get_end_time(smc_concrete_rsvn_t this);
 static bool smc_rsvn_is_readonly(smc_concrete_rsvn_t this);
-static const char *smc_rsvn_get_nodes(smc_concrete_rsvn_t this);
 
 static const char *smc_rsvn_set_drms_id(smc_concrete_rsvn_t this, const char *value);
@@ -170,10 +160,6 @@
 static struct tm smc_rsvn_set_start_time(smc_concrete_rsvn_t this, struct tm value);
 static struct tm smc_rsvn_set_end_time(smc_concrete_rsvn_t this, struct tm value);
-static const char *smc_rsvn_set_nodes(smc_concrete_rsvn_t this, const char *value);
-
 
 static sm_ret_code_t smc_rsvn_save(smc_concrete_rsvn_t this);
-
-static sm_ret_code_t smc_rsvn_verify_policy(smc_concrete_rsvn_t this);
 
 static void smc_rsvn_gen_id(smc_concrete_rsvn_t this);
@@ -190,13 +176,4 @@
 static void smc_rsvn_archive(smc_concrete_rsvn_t this);
 static void smc_rsvn_terminate(smc_concrete_rsvn_t this);
-
-/* reservation policies */
-#ifdef TEST
-int smc_rpolicy_max_duration = 7 * 24;
-int smc_rpolicy_max_slots = 100;
-#else
-extern unsigned int smc_rpolicy_max_duration;
-extern unsigned int smc_rpolicy_max_slots;
-#endif
 
 sm_status_ret_code_t
@@ -303,5 +280,4 @@
 	ret->super.get_start_time = (smc_rsvn_time_getter_function) smc_rsvn_get_start_time;
 	ret->super.get_end_time = (smc_rsvn_time_getter_function) smc_rsvn_get_end_time;
-	ret->super.get_nodes = (smc_rsvn_string_getter_function) smc_rsvn_get_nodes;
 
 	ret->super.set_drms_id = (smc_rsvn_string_setter_function) smc_rsvn_set_drms_id;
@@ -313,5 +289,4 @@
 	ret->super.set_start_time = (smc_rsvn_time_setter_function) smc_rsvn_set_start_time;
 	ret->super.set_end_time = (smc_rsvn_time_setter_function) smc_rsvn_set_end_time;
-	ret->super.set_nodes = (smc_rsvn_string_setter_function) smc_rsvn_set_nodes;
 
 	ret->super.archive = (smc_rsvn_void_setter_function) smc_rsvn_archive;
@@ -320,6 +295,4 @@
 	ret->super.is_readonly = (smc_rsvn_bool_getter_function) smc_rsvn_is_readonly;
 	ret->super.save = (smc_rsvn_save_function) smc_rsvn_save;
-	ret->super.verify_policy = (smc_rsvn_verify_policy_function)smc_rsvn_verify_policy;
-	ret->super.process_ardl = (smc_rsvn_process_ardl_function)smc_rsvn_process_ardl;
 
 	ret->new_entry = new;
@@ -353,41 +326,8 @@
 	} while (0)
 
-#define MAX_RESNAME_LEN (64)
-
-#define ESCAPE_NAME(str) \
-	do { \
-		int _i; \
-		if (!str) \
-			break; \
-		for (_i = 0; _i < (int)strlen(str); _i++) { \
-			if (!isalnum(str[_i]) && str[_i] != '_') \
-				str[_i] = '_'; \
-		} \
-		if (strlen(str) && !isalpha(str[0])) \
-			str[0] = 'R'; \
-		if (strlen(str) > MAX_RESNAME_LEN) \
-			str[MAX_RESNAME_LEN] = '\0'; \
-	} while (0);
-
-#define CHECK_IS_SAFE(str) \
-	do { \
-		int _i; \
-		sm_debug("CHECK_IS_SAFE(%s)",SM_STR(str));\
-		if (!str) \
-			break; \
-		for (_i = 0; _i < (int)strlen(str); _i++) { \
-			if (!isalnum(str[_i]) && str[_i] != '_' && str[_i] != '-' && str[_i] != '.' && str[_i] != ':') {\
-				sm_notice("Illegal character in element " SM_STR(str) ". Value: %s.",str); \
-				ret = sm_ret_code_create(SMC_RSVN_INVALID_ARGUMENT, "Illegal value of element" SM_STR(str)); \
-				goto fault; \
-			} \
-		} \
-	} while (0);
-
-
 static const char *smc_rsvn_get_id(smc_concrete_rsvn_t this) { CHECK_THIS; smc_rsvn_gen_id(this); return this->id; }
 static const char *smc_rsvn_get_drms_id(smc_concrete_rsvn_t this) { CHECK_THIS; return this->drms_id; }
 static const char *smc_rsvn_get_submitted_ardl(smc_concrete_rsvn_t this) { CHECK_THIS; return this->submitted_ardl; }
-static const char *smc_rsvn_get_ardl(smc_concrete_rsvn_t this) { CHECK_THIS; return this->ardl; }
+static const char *smc_rsvn_get_ardl(smc_concrete_rsvn_t this) { CHECK_THIS; smc_rsvn_process_ardl(this); return this->ardl; }
 static const char *smc_rsvn_get_subject(smc_concrete_rsvn_t this) { CHECK_THIS; return this->subject; }
 static const char *smc_rsvn_get_mapped_user(smc_concrete_rsvn_t this) { CHECK_THIS; return this->mapped_user; }
@@ -395,6 +335,4 @@
 static struct tm smc_rsvn_get_start_time(smc_concrete_rsvn_t this) { CHECK_THIS; return this->start_time; }
 static struct tm smc_rsvn_get_end_time(smc_concrete_rsvn_t this) { CHECK_THIS; return this->end_time; }
-static const char *smc_rsvn_get_nodes(smc_concrete_rsvn_t this) { CHECK_THIS; return this->nodes; }
-
 
 static const char *smc_rsvn_set_drms_id(smc_concrete_rsvn_t this, const char *value) { CHECK_THIS; SET_STR(drms_id); }
@@ -405,6 +343,4 @@
 static struct tm smc_rsvn_set_start_time(smc_concrete_rsvn_t this, struct tm value) { CHECK_THIS; SET(start_time); }
 static struct tm smc_rsvn_set_end_time(smc_concrete_rsvn_t this, struct tm value) { CHECK_THIS; SET(end_time); }
-static const char *smc_rsvn_set_nodes(smc_concrete_rsvn_t this, const char *value) { CHECK_THIS; SET_STR(nodes); }
-
 
 static void
@@ -538,6 +474,4 @@
 	rsvn->end_time = db_time;
 	rsvn->end_time_set = true;
-
-	SM_TRY_FAULT(stmt->get_string(stmt, 10, &rsvn->nodes));
 
 	return SM_OK;
@@ -766,5 +700,6 @@
 	*result = NULL;
 
-	odbc->lock(odbc);
+	if (odbc->begin_transaction(odbc) == SM_FAULT)
+		return sm_ret_code_create(SMC_RSVN_DATABASE_FAULT, SMC_RSVN_DATABASE_FAULT_STR);
 
 	stmt = find_all_readonly_stmt;
@@ -791,5 +726,5 @@
 	stmt->close_cursor(stmt);
 
-	odbc->unlock(odbc);
+	SM_TRY_FAULT(odbc->commit(odbc));
 
 	return sm_ret_code_create(SMC_RSVN_OK, NULL);
@@ -798,5 +733,5 @@
 	if (stmt)
 		stmt->close_cursor(stmt);
-	odbc->unlock(odbc);
+	odbc->rollback(odbc);
 	smc_rsvn_free(&rsvn);
 	sm_list_free_user(*result, (sm_list_free_user_function) smc_rsvn_free);
@@ -806,5 +741,5 @@
 	if (stmt)
 		stmt->close_cursor(stmt);
-	odbc->unlock(odbc);
+	odbc->rollback(odbc);
 	smc_rsvn_free(&rsvn);
 	sm_list_free_user(*result, (sm_list_free_user_function) smc_rsvn_free);
@@ -837,6 +772,4 @@
 	SM_FREE(concrete->subject);
 	SM_FREE(concrete->mapped_user);
-	SM_FREE(concrete->nodes);
-
 
 	sm_alloc_tracked_free(&concrete->tracked);
@@ -868,5 +801,31 @@
 		return SM_FAULT;
 
-	SM_TRY_FAULT(insert_stmt->execute(insert_stmt, "ssssssttts",
+	SM_TRY_FAULT(insert_stmt->execute(insert_stmt, "ssssssttt",
+			this->id,
+			this->drms_id,
+			this->submitted_ardl,
+			this->ardl,
+			this->subject,
+			this->mapped_user,
+			FIELD2DB(this->submission_time),
+			FIELD2DB(this->start_time),
+			FIELD2DB(this->end_time)));
+
+	SM_TRY_FAULT(odbc->commit(odbc));
+	return SM_OK;
+
+fault:
+	odbc->rollback(odbc);
+	return SM_FAULT;
+}
+
+static sm_status_ret_code_t
+smc_rsvn_update(smc_concrete_rsvn_t this)
+{
+	SM_DEBUG_ENTER_STR(this->id);
+
+	SM_ASSERT(this->in_transaction, "Reservation object inconsistent state");
+
+	SM_TRY_FAULT(update_stmt->execute(update_stmt, "ssssssttts",
 			this->id,
 			this->drms_id,
@@ -878,16 +837,18 @@
 			FIELD2DB(this->start_time),
 			FIELD2DB(this->end_time),
-			this->nodes));
+			this->id));
 
 	SM_TRY_FAULT(odbc->commit(odbc));
+	this->in_transaction = false;
 	return SM_OK;
 
 fault:
 	odbc->rollback(odbc);
+	this->in_transaction = false;
 	return SM_FAULT;
 }
 
 static sm_status_ret_code_t
-smc_rsvn_update(smc_concrete_rsvn_t this)
+smc_rsvn_move_to_acc(smc_concrete_rsvn_t this)
 {
 	SM_DEBUG_ENTER_STR(this->id);
@@ -895,5 +856,7 @@
 	SM_ASSERT(this->in_transaction, "Reservation object inconsistent state");
 
-	SM_TRY_FAULT(update_stmt->execute(update_stmt, "sssssstttss",
+	SM_TRY_FAULT(delete_stmt->execute(delete_stmt, "s", this->id));
+
+	SM_TRY_FAULT(insert_acc_stmt->execute(insert_acc_stmt, "ssssssttt",
 			this->id,
 			this->drms_id,
@@ -904,38 +867,5 @@
 			FIELD2DB(this->submission_time),
 			FIELD2DB(this->start_time),
-			FIELD2DB(this->end_time),
-			this->nodes,
-			this->id));
-
-	SM_TRY_FAULT(odbc->commit(odbc));
-	this->in_transaction = false;
-	return SM_OK;
-
-fault:
-	odbc->rollback(odbc);
-	this->in_transaction = false;
-	return SM_FAULT;
-}
-
-static sm_status_ret_code_t
-smc_rsvn_move_to_acc(smc_concrete_rsvn_t this)
-{
-	SM_DEBUG_ENTER_STR(this->id);
-
-	SM_ASSERT(this->in_transaction, "Reservation object inconsistent state");
-
-	SM_TRY_FAULT(delete_stmt->execute(delete_stmt, "s", this->id));
-
-	SM_TRY_FAULT(insert_acc_stmt->execute(insert_acc_stmt, "ssssssttts",
-			this->id,
-			this->drms_id,
-			this->submitted_ardl,
-			this->ardl,
-			this->subject,
-			this->mapped_user,
-			FIELD2DB(this->submission_time),
-			FIELD2DB(this->start_time),
-			FIELD2DB(this->end_time),
-			this->nodes));
+			FIELD2DB(this->end_time)));
 
 	SM_TRY_FAULT(odbc->commit(odbc));
@@ -1146,35 +1076,4 @@
 	}
 
-	/* sanity check - prevents script injection */
-	if (ardl.ardl__ReservationDescription->ReservationIdentification) {
-		int j;
-		ESCAPE_NAME(ardl.ardl__ReservationDescription->ReservationIdentification->ReservationName);
-
-		for (j=0; j < ardl.ardl__ReservationDescription->ReservationIdentification->__sizeProject; j++)
-			CHECK_IS_SAFE(ardl.ardl__ReservationDescription->ReservationIdentification->Project[j])
-	}
-
-	if (ardl.ardl__ReservationDescription->ardl__Resources) {
-		struct ardl__ARDLResources_USCOREType *r = ardl.ardl__ReservationDescription->ardl__Resources;
-		int j;
-
-		CHECK_IS_SAFE(r->UserName);
-		CHECK_IS_SAFE(r->GroupName);
-
-		if (r->OperatingSystem)
-			CHECK_IS_SAFE(r->OperatingSystem->jsdl__OperatingSystemVersion);
-		for (j=0; j < r->__sizeNativeResource; j++)
-			CHECK_IS_SAFE(r->NativeResource[j].name);
-		if (r->CandidateHosts) {
-			for (j=0; j < r->CandidateHosts->__sizeHostName; j++)
-				CHECK_IS_SAFE(r->CandidateHosts->HostName[j]);
-		}
-		this->slots_count = (r->ReservedSlotsCount ? *r->ReservedSlotsCount : 0) + 
-			(r->AdditionalReservedSlotsCount ? *r->AdditionalReservedSlotsCount : 0);
-	} 
-		
-	
-
-
 	SM_FREE(this->ardl);
 	SM_TRY_NOT(this->ardl = smc_ardl_str(&ardl, NULL, NULL));
@@ -1184,6 +1083,4 @@
 
 fault:
-	SM_FREE(this->ardl);
-	sm_notice("Fault on ARDL processing: %d", ret.code);
 	sm_alloc_tracked_free(&tracked);
 	if (ret.code)
@@ -1262,28 +1159,4 @@
 	return sm_ret_code_create(SMC_RSVN_OK, NULL);
 }
-
-sm_ret_code_t
-smc_rsvn_verify_policy(smc_concrete_rsvn_t this)
-{
-	time_t start_time = mktime(&this->start_time);
-	time_t end_time = mktime(&this->end_time);
-
-	sm_info("Verifing reservation start=%u,end=%u,max slots=%d", (unsigned int)start_time, (unsigned int)end_time, this->slots_count);
-
-	/* verify max duration */
-	SM_ASSERT(start_time < end_time, "reservation start_time >= end_time ???");
-
-	/* duration */
-	if ((unsigned int)(end_time - start_time) > (smc_rpolicy_max_duration * 3600) ) {
-		return sm_ret_code_create(SMC_RSVN_INVALID_ARGUMENT, "Reservation duration exceeds max duration policy");
-	}
-
-	if (smc_rpolicy_max_slots && smc_rpolicy_max_slots < this->slots_count) {
-		return sm_ret_code_create(SMC_RSVN_INVALID_ARGUMENT, "Reservation request  exceeds max slots policy");
-	}
-
-	return sm_ret_code_create(SMC_RSVN_OK, NULL);
-}
-
 
 int
@@ -1384,39 +1257,4 @@
 ";
 
-static const char *ardl_res_name =
-"\
-<ReservationDefinition xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/ardl\">\
-<ReservationDescription>\
-<ReservationIdentification>\
-<ReservationName>!Simple Reservation; &$$#@!$</ReservationName>\
-</ReservationIdentification>\
-<TimeWindow>\
-<Duration>PT02H00M00S</Duration>\
-</TimeWindow>\
-<Resources>\
-<ReservedSlotsCount>1</ReservedSlotsCount>\
-</Resources>\
-</ReservationDescription>\
-</ReservationDefinition>\
-";
-
-static const char *ardl_invalid_user =
-"\
-<ReservationDefinition xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/ardl\">\
-<ReservationDescription>\
-<ReservationIdentification>\
-<ReservationName>1234Simple Reservation</ReservationName>\
-</ReservationIdentification>\
-<TimeWindow>\
-<Duration>PT02H00M00S</Duration>\
-</TimeWindow>\
-<Resources>\
-<ReservedSlotsCount>1</ReservedSlotsCount>\
-<GroupName>Group; echo Fail</GroupName>\
-</Resources>\
-</ReservationDescription>\
-</ReservationDefinition>\
-";
-
 static void
 test_prepare(void)
Index: trunk/src/modules/qcg_comp_service/db.h
===================================================================
--- trunk/src/modules/qcg_comp_service/db.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/db.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_DB_H
Index: trunk/src/modules/qcg_comp_service/staging.c
===================================================================
--- trunk/src/modules/qcg_comp_service/staging.c	(revision 865)
+++ trunk/src/modules/qcg_comp_service/staging.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -243,11 +236,5 @@
 
 					sm_strerror_r(errno, errbuf, sizeof(errbuf));
-
-					if (errno == EISDIR) {
-						sm_info("Failed to delete file %s: %s", buf, errbuf);
-					} else {
-						sm_notice("Failed to delete file %s: %s", buf, errbuf);
-					}
-
+					sm_notice("Failed to delete file %s: %s", buf, errbuf);
 					set_staging_fault(job, STAGING_DELETE_ON_TERMINATION_FAULT, buf);
 
Index: trunk/src/modules/qcg_comp_service/rsvn.h
===================================================================
--- trunk/src/modules/qcg_comp_service/rsvn.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/rsvn.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_RSVN_H
@@ -58,7 +51,4 @@
 typedef sm_ret_code_t (*smc_rsvn_save_function)(struct smc_rsvn_s *this);
 
-typedef sm_ret_code_t (*smc_rsvn_verify_policy_function)(struct smc_rsvn_s *this);
-typedef sm_ret_code_t (*smc_rsvn_process_ardl_function)(struct smc_rsvn_s *this);
-
 typedef struct smc_rsvn_s {
 	smc_rsvn_string_getter_function get_id;
@@ -72,5 +62,4 @@
 	smc_rsvn_time_getter_function get_start_time;
 	smc_rsvn_time_getter_function get_end_time;
-	smc_rsvn_string_getter_function get_nodes;
 
 	smc_rsvn_string_setter_function set_drms_id;
@@ -82,5 +71,4 @@
 	smc_rsvn_time_setter_function set_start_time;
 	smc_rsvn_time_setter_function set_end_time;
-	smc_rsvn_string_setter_function set_nodes;
 
 	smc_rsvn_void_setter_function archive;
@@ -88,7 +76,4 @@
 	smc_rsvn_bool_getter_function is_readonly;
 	smc_rsvn_save_function save;
-
-	smc_rsvn_verify_policy_function verify_policy;
-	smc_rsvn_process_ardl_function process_ardl;
 } *smc_rsvn_t;
 
Index: trunk/src/modules/qcg_comp_service/staging.h
===================================================================
--- trunk/src/modules/qcg_comp_service/staging.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/staging.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_STAGING_H
Index: trunk/src/modules/qcg_comp_service/icomm.c
===================================================================
--- trunk/src/modules/qcg_comp_service/icomm.c	(revision 623)
+++ trunk/src/modules/qcg_comp_service/icomm.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <sys/types.h>
@@ -384,19 +377,4 @@
 
 sm_status_ret_code_t
-smc_icomm_request_GetDRMS(uid_t uid, sm_value_t *empty, sm_value_t **result)
-{
-	SM_DEBUG_ENTER();
-	return smc_icomm_create_process_and_send(uid, SM_TRUE, empty, result, smc_icomm_GetDRMS);
-}
-
-sm_status_ret_code_t
-smc_icomm_request_GetDRMSInfos(uid_t uid, sm_value_t *params, sm_value_t **result)
-{
-	SM_DEBUG_ENTER();
-	return smc_icomm_create_process_and_send(uid, SM_TRUE, params, result, smc_icomm_GetDRMSInfos);
-}
-
-
-sm_status_ret_code_t
 smc_icomm_begin_receive(int fd, smc_icomm_request_t *result)
 {
@@ -559,19 +537,4 @@
 
 sm_status_ret_code_t
-smc_icomm_receive_GetDRMS(int fd, sm_value_t **empty)
-{
-	SM_DEBUG_ENTER();
-	return smc_icomm_receive_value(fd, empty);
-}
-
-sm_status_ret_code_t
-smc_icomm_receive_GetDRMSInfos(int fd, sm_value_t **params)
-{
-	SM_DEBUG_ENTER();
-	return smc_icomm_receive_value(fd, params);
-}
-
-
-sm_status_ret_code_t
 smc_icomm_respond_CreateActivity(int fd, sm_value_t *result)
 {
@@ -716,37 +679,4 @@
         return ret;
 }
-
-sm_status_ret_code_t
-smc_icomm_respond_GetDRMS(int fd, sm_value_t *result)
-{
-	sm_status_ret_code_t ret;
-
-	SM_DEBUG_ENTER();
-
-	if (!result)
-		result = SM_VALUE_RET_CODE_OOM_SINGLETON;
-
-	if ((ret = sm_value_to_fd(fd, result)) == SM_OK)
-		sm_value_free(&result);
-
-	return ret;
-}
-
-sm_status_ret_code_t
-smc_icomm_respond_GetDRMSInfos(int fd, sm_value_t *result)
-{
-	sm_status_ret_code_t ret;
-
-	SM_DEBUG_ENTER();
-
-	if (!result)
-		result = SM_VALUE_RET_CODE_OOM_SINGLETON;
-
-	if ((ret = sm_value_to_fd(fd, result)) == SM_OK)
-		sm_value_free(&result);
-
-	return ret;
-}
-
 
 #define ICOMM_REQUEST(name) sm_status_ret_code_t \
Index: trunk/src/modules/qcg_comp_service/qcg_comp_staging.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_staging.c	(revision 662)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_staging.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -98,10 +91,10 @@
 
 	if (!SM_VALUE_RET_CODE_OK(result[0])) {
-		ctxt->error_detail = sm_value_clone(result);
+		ctxt->error_detail = result;
 		goto fault;
 	}
 
 	ctxt->buffer_size = BUFFER_SIZE;
-	SM_TRY_NOT(ctxt->buffer = sm_malloc(ctxt->buffer_size));
+	ctxt->buffer = sm_malloc(ctxt->buffer_size); /*JP where is coresponding sm_free */
 
 	sm_value_free(&params);
@@ -112,5 +105,4 @@
 	ctxt->error_state = SM_TRUE;
 	sm_value_free(&params);
-	sm_value_free(&result);
 	return handle;
 }
@@ -130,5 +122,5 @@
 	if(ctxt->buffer_size < len) {
 		ctxt->buffer_size = len;
-		SM_TRY_NOT(ctxt->buffer = sm_realloc(ctxt->buffer, ctxt->buffer_size));
+		ctxt->buffer = sm_realloc(ctxt->buffer, ctxt->buffer_size);
 	}
 
@@ -148,5 +140,5 @@
 
 		if (!SM_VALUE_RET_CODE_OK(result[0])) {
-			ctxt->error_detail = sm_value_clone(result);
+			ctxt->error_detail = result;
 			goto fault;
 		}
@@ -169,5 +161,4 @@
 	ctxt->error_state = SM_TRUE;
 	sm_value_free(&params);
-	sm_value_free(&result);
 	return SM_OK; /* yes, we must return SM_OK otherwise user will not get meaningful error message */
 }
@@ -194,11 +185,10 @@
 
 	if (!SM_VALUE_RET_CODE_OK(result[0])) {
-		ctxt->error_detail = sm_value_clone(result);
-		goto fault;
-	}
-
-	sm_value_free(&params);
-	sm_value_free(&result);
-	SM_FREE(ctxt->buffer);
+		ctxt->error_detail = result;
+		goto fault;
+	}
+
+	sm_value_free(&params);
+	sm_value_free(&result);
 	return;
 
@@ -206,6 +196,4 @@
 	ctxt->error_state = SM_TRUE;
 	sm_value_free(&params);
-	sm_value_free(&result);
-	SM_FREE(ctxt->buffer);
 }
 
@@ -232,5 +220,5 @@
 
 	if (!SM_VALUE_RET_CODE_OK(result[0])) {
-		ctxt->error_detail = sm_value_clone(result);
+		ctxt->error_detail = result;
 		goto fault;
 	}
@@ -274,5 +262,5 @@
 
 	if (!SM_VALUE_RET_CODE_OK(result[0])) {
-		ctxt->error_detail = sm_value_clone(result);
+		ctxt->error_detail = result;
 		goto fault;
 	}
@@ -333,5 +321,5 @@
 
 		if (!SM_VALUE_RET_CODE_OK(result[0])) {
-			ctxt->error_detail = sm_value_clone(result);
+			ctxt->error_detail = result;
 			goto fault;
 		}
@@ -573,5 +561,5 @@
 	sm_value_t *result = NULL;
 	int count, i;
-	char *username = (request->UserName ? sm_strdup(request->UserName) : NULL);
+	char *username = request->UserName;
 	uid_t uid = 0;
 
@@ -625,5 +613,4 @@
 	}
 
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -631,5 +618,4 @@
 
 fault:
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -646,5 +632,5 @@
 	sm_value_t *params = NULL;
 	sm_value_t *result = NULL;
-	char *username = (request->UserName ? sm_strdup(request->UserName) : NULL);
+	char *username = request->UserName;
 	uid_t uid;
 	int i = 0;
@@ -688,13 +674,10 @@
 		response->Files[i].Size = result[7]->vuint32;
 		response->Files[i].UID = transport->transport_strdup(transport, result[8]->vstring);
-
-		sm_value_free(&result);
-	}
-	
-	SM_FREE(username);
+	}
+
+	sm_value_free(&result);
 	return SM_DEBUG_LEAVE_INT(transport->exit(transport, NULL));
 
 fault:
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -710,5 +693,5 @@
 	sm_value_t *params = NULL;
 	sm_value_t *result = NULL;
-	char *username = (request->UserName ? sm_strdup(request->UserName) : NULL);
+	char *username = request->UserName;
 	uid_t uid;
 
@@ -738,5 +721,4 @@
 	}
 
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -744,5 +726,4 @@
 
 fault:
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -758,5 +739,5 @@
 	sm_value_t *params = NULL;
 	sm_value_t *result = NULL;
-	char *username = (request->UserName ? sm_strdup(request->UserName) : NULL);
+	char *username = request->UserName;
 	uid_t uid;
 	mode_t mode = 0644;
@@ -795,5 +776,4 @@
 	}
 
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -801,5 +781,4 @@
 
 fault:
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -815,5 +794,5 @@
 	sm_value_t *params = NULL;
 	sm_value_t *result = NULL;
-	char *username = (request->UserName ? sm_strdup(request->UserName) : NULL);
+	char *username = request->UserName;
 	uid_t uid;
 	mode_t mode = 0755;
@@ -856,5 +835,4 @@
 	}
 
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
@@ -862,5 +840,4 @@
 
 fault:
-	SM_FREE(username);
 	sm_value_free(&result);
 	sm_value_free(&params);
Index: trunk/src/modules/qcg_comp_service/identifiers.c
===================================================================
--- trunk/src/modules/qcg_comp_service/identifiers.c	(revision 338)
+++ trunk/src/modules/qcg_comp_service/identifiers.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <qcg-core/sm.h>
@@ -174,5 +167,5 @@
 			sm_debug("dom->type = %d", dom->type);
 
-			if (dom->type == SOAP_TYPE__qcf__ActivityId) {
+			if (dom->type == SOAP_TYPE__qcg_comp_factory__ActivityId) {
 				const char *value = (const char *) dom->node;
 				size_t ignore = 9; /* == strlen("urn:uuid:") */
Index: trunk/src/modules/qcg_comp_service/qcg_comp_rsync.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_rsync.c	(revision 338)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_rsync.c	(revision 1)
@@ -1,25 +1,2 @@
-/* $Id:$ */
-
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
Index: trunk/src/modules/qcg_comp_service/icomm.h
===================================================================
--- trunk/src/modules/qcg_comp_service/icomm.h	(revision 623)
+++ trunk/src/modules/qcg_comp_service/icomm.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_ICOMM_H
@@ -62,6 +55,4 @@
 	smc_icomm_ChMod,
 	smc_icomm_MkDir,
-	smc_icomm_GetDRMS,
-	smc_icomm_GetDRMSInfos
 } smc_icomm_request_t;
 
@@ -86,7 +77,4 @@
 sm_status_ret_code_t smc_icomm_request_StageOutClose(int context, sm_value_t *params, sm_value_t **result);
 sm_status_ret_code_t smc_icomm_request_StageOutDestroyContext(int *context, void **handle, sm_value_t *empty, sm_value_t **result);
-sm_status_ret_code_t smc_icomm_request_GetDRMS(uid_t uid, sm_value_t *empty, sm_value_t **result);
-sm_status_ret_code_t smc_icomm_request_GetDRMSInfos(uid_t uid, sm_value_t *params, sm_value_t **result);
-
 
 sm_status_ret_code_t smc_icomm_begin_receive(int fd, smc_icomm_request_t *result);
@@ -111,7 +99,4 @@
 sm_status_ret_code_t smc_icomm_receive_StageOutDestroyContext(int fd, sm_value_t **empty);
 sm_status_ret_code_t smc_icomm_request_StageOutRelease(int *context, void **handle);
-sm_status_ret_code_t smc_icomm_receive_GetDRMS(int fd, sm_value_t **empty);
-sm_status_ret_code_t smc_icomm_receive_GetDRMSInfos(int fd, sm_value_t **params);
-
 
 sm_status_ret_code_t smc_icomm_respond_CreateActivity(int fd, sm_value_t *result);
@@ -124,7 +109,4 @@
 sm_status_ret_code_t smc_icomm_respond_StageIn(int fd, sm_value_t *result);
 sm_status_ret_code_t smc_icomm_respond_StageOut(int fd, sm_value_t *result);
-sm_status_ret_code_t smc_icomm_respond_GetDRMS(int fd, sm_value_t *result);
-sm_status_ret_code_t smc_icomm_respond_GetDRMSInfos(int fd, sm_value_t *result);
-
 
 #define ICOMM_DECL(name) \
Index: trunk/src/modules/qcg_comp_service/job.c
===================================================================
--- trunk/src/modules/qcg_comp_service/job.c	(revision 963)
+++ trunk/src/modules/qcg_comp_service/job.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <stdbool.h>
@@ -52,5 +45,4 @@
 #ifdef TEST
 #include <stub/qcgcomp.nsmap>
-SM_BOOL smc_use_scratch = SM_FALSE;
 #else
 extern struct Namespace qcgcomp_namespaces[];
@@ -64,6 +56,4 @@
         }
 };
-
-extern SM_BOOL smc_redirect_stdouterr;
 
 typedef struct smc_concrete_job_s {
@@ -95,7 +85,4 @@
 	int walltime;
 	char *nodes;
-	bool cancelled;
-	char *domain;
-	char *ext_info;
 	sm_value_t *atc_token;
 
@@ -111,5 +98,5 @@
 	bool vmem_usage_set;
 	bool walltime_set;
-	bool cancelled_set;
+
 
 	sm_alloc_tracked_t tracked;
@@ -133,12 +120,11 @@
 static const char *insert_txt = "INSERT INTO jobs (id, drms_id, reservation_id,"
 	"submitted_jsdl, jsdl, subject, mapped_user, state, staging_fault, submission_time, start_time,"
-	"end_time, exit_status, core_dumped, posix_signal_name, cpu_usage, mem_usage, vmem_usage, queue, project, walltime, nodes, cancelled, domain, ext_info)"
-	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+	"end_time, exit_status, core_dumped, posix_signal_name, cpu_usage, mem_usage, vmem_usage, queue, project, walltime, nodes)"
+	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
 static const char *update_txt = "UPDATE jobs SET id = ?, drms_id = ?,"
 	"reservation_id = ?, submitted_jsdl = ?, jsdl = ?, subject = ?, mapped_user = ?,"
 	"state = ?, staging_fault = ?, submission_time = ?, start_time = ?, end_time = ?, exit_status = ?,"
-	"core_dumped = ?, posix_signal_name = ?, cpu_usage = ?, mem_usage = ?, vmem_usage = ?, queue = ?, project = ?, walltime = ?, nodes = ?,"
-	"cancelled = ? , domain = ?, ext_info = ? WHERE serial = ?";
+	"core_dumped = ?, posix_signal_name = ?, cpu_usage = ?, mem_usage = ?, vmem_usage = ?, queue = ?, project = ?, walltime = ?, nodes = ? WHERE serial = ?";
 
 static const char *delete_txt = "DELETE FROM jobs WHERE id = ?";
@@ -146,6 +132,6 @@
 static const char *insert_acc_txt = "INSERT INTO jobs_acc (id, drms_id, reservation_id,"
 	"submitted_jsdl, jsdl, subject, mapped_user, state, staging_fault, submission_time, start_time,"
-	"end_time, exit_status, core_dumped, posix_signal_name, cpu_usage, mem_usage, vmem_usage, queue, project, walltime, nodes, cancelled, domain, ext_info)"
-	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+	"end_time, exit_status, core_dumped, posix_signal_name, cpu_usage, mem_usage, vmem_usage, queue, project, walltime, nodes)"
+	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
 static const char *count_txt = "SELECT count(*) FROM jobs";
@@ -177,5 +163,4 @@
 static smc_job_res_info_t smc_job_get_reservation_info(smc_concrete_job_t this);
 static const char *smc_job_get_submitted_jsdl(smc_concrete_job_t this);
-static _jsdl__JobDefinition *smc_job_get_submitted_jsdl_parsed(smc_concrete_job_t this);
 static const char *smc_job_get_jsdl(smc_concrete_job_t this);
 static _jsdl__JobDefinition *smc_job_get_jsdl_parsed(smc_concrete_job_t this);
@@ -199,8 +184,4 @@
 static int smc_job_get_walltime(smc_concrete_job_t this);
 static const char* smc_job_get_nodes(smc_concrete_job_t this);
-static bool smc_job_get_cancelled(smc_concrete_job_t this);
-static bool smc_job_has_cancelled(smc_concrete_job_t this);
-static const char* smc_job_get_domain(smc_concrete_job_t this);
-static const char *smc_job_get_and_process_ext_info(smc_concrete_job_t this);
 static sm_value_t *smc_job_get_atc_token(smc_concrete_job_t this);
 
@@ -215,5 +196,4 @@
 static const char *smc_job_set_staging_fault(smc_concrete_job_t this, const char *value);
 static struct tm smc_job_set_start_time(smc_concrete_job_t this, struct tm value);
-static struct tm smc_job_set_end_time(smc_concrete_job_t this, struct tm value);
 static unsigned char smc_job_set_exit_status(smc_concrete_job_t this, unsigned char value);
 static bool smc_job_set_core_dumped(smc_concrete_job_t this, bool value);
@@ -226,7 +206,4 @@
 static int smc_job_set_walltime(smc_concrete_job_t this, int value);
 static const char *smc_job_set_nodes(smc_concrete_job_t this, const char *value);
-static const char *smc_job_set_domain(smc_concrete_job_t this, const char *value);
-static bool smc_job_set_cancelled(smc_concrete_job_t this, bool value);
-static const char *smc_job_set_and_process_ext_info(smc_concrete_job_t this, const char *value);
 static sm_value_t *smc_job_set_atc_token(smc_concrete_job_t this, sm_value_t *value);
 
@@ -246,5 +223,4 @@
 static bool smc_job_is_readonly(smc_concrete_job_t this);
 static struct tm timetm(void);
-
 
 sm_status_ret_code_t
@@ -414,5 +390,4 @@
 	ret->super.get_reservation_info = (smc_job_reservation_info_getter_function) smc_job_get_reservation_info;
 	ret->super.get_submitted_jsdl = (smc_job_string_getter_function) smc_job_get_submitted_jsdl;
-	ret->super.get_submitted_jsdl_parsed = (smc_job_jsdl_parsed_getter_function) smc_job_get_submitted_jsdl_parsed;
 	ret->super.get_jsdl = (smc_job_string_getter_function) smc_job_get_jsdl;
 	ret->super.get_jsdl_parsed = (smc_job_jsdl_parsed_getter_function) smc_job_get_jsdl_parsed;
@@ -436,8 +411,4 @@
 	ret->super.get_walltime = (smc_job_int_getter_function) smc_job_get_walltime;
 	ret->super.get_nodes = (smc_job_string_getter_function) smc_job_get_nodes;
-	ret->super.get_cancelled = (smc_job_bool_getter_function) smc_job_get_cancelled;
-	ret->super.has_cancelled = (smc_job_bool_getter_function) smc_job_has_cancelled;
-	ret->super.get_domain = (smc_job_string_getter_function) smc_job_get_domain;
-	ret->super.get_ext_info = (smc_job_string_getter_function) smc_job_get_and_process_ext_info;
 	ret->super.get_atc_token = (smc_job_value_getter_function) smc_job_get_atc_token;
 
@@ -453,5 +424,4 @@
 	ret->super.set_staging_fault = (smc_job_string_setter_function) smc_job_set_staging_fault;
 	ret->super.set_start_time = (smc_job_time_setter_function) smc_job_set_start_time;
-	ret->super.set_end_time = (smc_job_time_setter_function) smc_job_set_end_time;
 	ret->super.set_exit_status = (smc_job_byte_setter_function) smc_job_set_exit_status;
 	ret->super.set_core_dumped = (smc_job_bool_setter_function) smc_job_set_core_dumped;
@@ -464,7 +434,4 @@
 	ret->super.set_walltime = (smc_job_int_setter_function) smc_job_set_walltime;
 	ret->super.set_nodes = (smc_job_string_setter_function) smc_job_set_nodes;
-	ret->super.set_cancelled = (smc_job_bool_setter_function) smc_job_set_cancelled;
-	ret->super.set_domain = (smc_job_string_setter_function) smc_job_set_domain;
-	ret->super.set_ext_info = (smc_job_string_setter_function) smc_job_set_and_process_ext_info;
 	ret->super.set_atc_token = (smc_job_value_setter_function) smc_job_set_atc_token;
 
@@ -493,5 +460,6 @@
 		this->modified = true; \
 		SM_FREE(this->field); \
-		if (!(this->field = sm_strdup(value))) { \
+		this->field = sm_strdup(value); \
+		if (!this->field) { \
 			this->error = sm_ret_code_create(SMC_JOB_INTERNAL_FAULT, "Out of memory"); \
 			return NULL; \
@@ -501,8 +469,9 @@
 
 #define SET_VALUE(field) \
-	do { \
+	do {  \
 		this->modified = true; \
 		sm_value_free(&this->field); \
-		if (!(this->field = sm_value_clone(value))) { \
+		this->field = sm_value_clone(value); \
+		if (!this->field) { \
 			this->error = sm_ret_code_create(SMC_JOB_INTERNAL_FAULT, "Out of memory"); \
 			return NULL; \
@@ -533,6 +502,4 @@
 static int smc_job_get_walltime(smc_concrete_job_t this) { CHECK_THIS; return this->walltime; }
 static const char* smc_job_get_nodes(smc_concrete_job_t this) { CHECK_THIS; return this->nodes; }
-static bool smc_job_get_cancelled(smc_concrete_job_t this) { CHECK_THIS; return this->cancelled; }
-static const char* smc_job_get_domain(smc_concrete_job_t this) { CHECK_THIS; return this->domain; }
 static sm_value_t *smc_job_get_atc_token(smc_concrete_job_t this) { CHECK_THIS; return this->atc_token; }
 
@@ -545,5 +512,4 @@
 static const char *smc_job_set_mapped_user(smc_concrete_job_t this, const char *value) { CHECK_THIS; SET_STR(mapped_user); }
 static struct tm smc_job_set_start_time(smc_concrete_job_t this, struct tm value) { CHECK_THIS; SET(start_time); }
-static struct tm smc_job_set_end_time(smc_concrete_job_t this, struct tm value) { CHECK_THIS; SET(end_time); }
 static unsigned char smc_job_set_exit_status(smc_concrete_job_t this, unsigned char value) { CHECK_THIS; SET(exit_status); }
 static bool smc_job_set_core_dumped(smc_concrete_job_t this, bool value) { CHECK_THIS; SET(core_dumped); }
@@ -556,6 +522,4 @@
 static int smc_job_set_walltime(smc_concrete_job_t this, int value) { CHECK_THIS; SET(walltime); }
 static const char *smc_job_set_nodes(smc_concrete_job_t this, const char *value) { CHECK_THIS; SET_STR(nodes); }
-static bool smc_job_set_cancelled(smc_concrete_job_t this, bool value) { CHECK_THIS; SET(cancelled);}
-static const char *smc_job_set_domain(smc_concrete_job_t this, const char *value) { CHECK_THIS; SET_STR(domain); }
 static sm_value_t *smc_job_set_atc_token(smc_concrete_job_t this, sm_value_t *value) { CHECK_THIS; SET_VALUE(atc_token); }
 
@@ -629,9 +593,4 @@
 		return value;
 
-	if ((this->cancelled_set && this->cancelled) && (value == SMC_FAILED || value == SMC_FINISHED)) {
-		sm_info("Job %s was cancelled. Setting Cancelled instead of %s", this->drms_id, smc_job_state_str(value)); 
-		value = SMC_CANCELLED;
-	}
-
 	this->previous_state = this->state;
 	this->state = value;
@@ -640,25 +599,4 @@
 }
 
-/* we are not saving deserialized submitted jsdl due to rarely usage of this structure */
-static _jsdl__JobDefinition *
-smc_job_get_submitted_jsdl_parsed(smc_concrete_job_t this)
-{
-	_jsdl__JobDefinition j;
-
-	CHECK_THIS;
-
-	if (!this->submitted_jsdl)
-		return NULL;
-
-	sm_alloc_tracked_free(&this->tracked);
-
-	memset(&j, 0, sizeof(j));
-	SM_TRY_NOT(this->tracked = smc_jsdl_from_str(this->submitted_jsdl, &j));
-	return sm_alloc_tracked_memdup(this->tracked, &j, sizeof(j));
-
-fault:
-	return NULL;
-}
-
 static _jsdl__JobDefinition *
 smc_job_get_jsdl_parsed(smc_concrete_job_t this)
@@ -700,139 +638,4 @@
 }
 
-
-static char *
-smc_ext_info_str(_qcf__ActivityInfo *info)
-{
-	char *tmp = NULL;
-
-	SM_MANDATORY_P(info);
-
-	SM_DEBUG_ENTER();
-
-	tmp = sm_gsoap_buffer_put(info, qcf__ActivityInfo_USCOREType, "qcf:ActivityInfo", qcgcomp_namespaces);
-
-	if (tmp) {
-		return tmp;
-	} else {
-		sm_error("Failed to get string representation of ext info");
-		return NULL;
-	}
-
-}
-
-static sm_alloc_tracked_t
-smc_ext_info_from_str(const char *ext_info_str, _qcf__ActivityInfo *ext_info)
-{
-	sm_alloc_tracked_t handle;
-
-	SM_MANDATORY_P(ext_info_str);
-	SM_MANDATORY_P(ext_info);
-
-	SM_DEBUG_ENTER();
-
-	handle = sm_gsoap_buffer_get(ext_info_str, ext_info, qcf__ActivityInfo_USCOREType, NULL, qcgcomp_namespaces);
-
-	if (!handle)
-		sm_error("Failed to parse ext info from string");
-
-	return handle;
-}
-
-static const char *
-smc_job_get_and_process_ext_info(smc_concrete_job_t this)
-{
-	_qcf__ActivityInfo a;
-        char *new_value = NULL;
-	sm_alloc_tracked_t tracked = NULL;
-
-	CHECK_THIS;
-	//no previous info set, no need to process
-	if (!this->ext_info) {
-		return this->ext_info;
-	}
-	
-	//deserialize
-	memset(&a, 0, sizeof(a));
-
-	tracked = smc_ext_info_from_str(this->ext_info, &a);
-
-	if (!tracked)
-		goto fault;
-
-	/* 1. job has started, clear EstStartTime */
-	if (a.EstimatedStartTime != NULL && this->state >= SMC_EXECUTING) {
-		a.EstimatedStartTime = NULL;
-		/* serialize again into string */
-		new_value = smc_ext_info_str(&a);
-
-		this->modified = true;
-		SM_FREE(this->ext_info);
-		this->ext_info = new_value;
-	}
-
-	sm_alloc_tracked_free(&tracked);
-	return this->ext_info;
-fault:
-	sm_error("Failed to parse job info %s", this->ext_info);
-	sm_alloc_tracked_free(&tracked);
-	return NULL;
-}
-
-
-static const char *
-smc_job_set_and_process_ext_info(smc_concrete_job_t this, const char *value)
-{
-	_qcf__ActivityInfo a_new, a_old;
-        char *new_value = NULL;
-	sm_alloc_tracked_t tracked_new = NULL;
-	sm_alloc_tracked_t tracked_old = NULL;
-
-	CHECK_THIS;
-
-	//no previous info set, no need to process
-	if (!this->ext_info) {
-		this->modified = true;
-        	this->ext_info = sm_strdup(value);
-		return this->ext_info;
-	}
-        //we want to keep last non-null value
-        if (!value)
-		return this->ext_info;
-
-	//now we know that both old and new value is not null
-	memset(&a_new, 0, sizeof(a_new));
-	memset(&a_old, 0, sizeof(a_old));
-
-	tracked_new = smc_ext_info_from_str(value, &a_new);
-	tracked_old = smc_ext_info_from_str(this->ext_info, &a_old);
-
-	if (!tracked_new || !tracked_old)
-		goto fault;
-
-	/* 1. new value has no est start time, but old has */
-	if (a_new.EstimatedStartTime == NULL && a_old.EstimatedStartTime != NULL)
-		a_new.EstimatedStartTime = a_old.EstimatedStartTime;
-
-        /* ...we check  no  est start time if job is running in read */
-
-        /* serialize again into string */
-	new_value = smc_ext_info_str(&a_new);
-
-	sm_alloc_tracked_free(&tracked_new);
-	sm_alloc_tracked_free(&tracked_old);
-
-	this->modified = true;
-        SM_FREE(this->ext_info);
-        this->ext_info = new_value;
-	return this->ext_info;
-fault:
-	sm_error("Failed to parse job info %s", value);
-	sm_alloc_tracked_free(&tracked_new);
-	sm_alloc_tracked_free(&tracked_old);
-	return NULL;
-}
-
-
-
 static bool
 smc_job_has_exit_status(smc_concrete_job_t this)
@@ -850,13 +653,4 @@
 	return this->core_dumped_set;
 }
-
-static bool
-smc_job_has_cancelled(smc_concrete_job_t this)
-{
-	CHECK_THIS;
-	SM_DEBUG_ENTER();
-	return this->cancelled_set;
-}
-
 
 static sm_status_ret_code_t
@@ -889,5 +683,4 @@
 	if (db_string) {
 		job->state = smc_job_state_parse(db_string);
-		job->previous_state = job->state;
 		SM_FREE(db_string);
 	}
@@ -955,13 +748,4 @@
 
 	SM_TRY_FAULT(stmt->get_string(stmt, 23, &job->nodes));
-	
-	SM_TRY_FAULT(status = stmt->get_bit(stmt, 24, &db_bit));
-	if (status != SM_NEG) {
-		job->cancelled = (bool) db_bit;
-		job->cancelled_set = true;
-	}
-
-	SM_TRY_FAULT(stmt->get_string(stmt, 25, &job->domain));
-	SM_TRY_FAULT(stmt->get_string(stmt, 26, &job->ext_info));
 
 	job->atc_token = NULL; /* We do not save credentials into database as this would led to some security risk */
@@ -995,11 +779,6 @@
 	*result = NULL;
 
-	/* we run in transcation only non-readonly job queries */
-	if (!readonly) {
-		if (odbc->begin_transaction(odbc) == SM_FAULT)
-			return sm_ret_code_create(SMC_JOB_DATABASE_FAULT, SMC_JOB_DATABASE_FAULT_STR);
-	} else {
-		odbc->lock(odbc);
-	}
+	if (odbc->begin_transaction(odbc) == SM_FAULT)
+		return sm_ret_code_create(SMC_JOB_DATABASE_FAULT, SMC_JOB_DATABASE_FAULT_STR);
 
 	/* Try in jobs first. */
@@ -1032,5 +811,5 @@
 		SM_TRY_NOT(job = smc_job_create_internal(readonly, false, !readonly));
 
-		SMC_DB_TRY_FAULT(smc_job_read_from_db((smc_concrete_job_t) job, stmt ));
+		SMC_DB_TRY_FAULT(smc_job_read_from_db((smc_concrete_job_t) job, stmt));
 
 		SM_TRY_NOT(sm_list_add(result, job, 0));
@@ -1045,7 +824,6 @@
 	stmt->close_cursor(stmt);
 
-	//the commit would occur on job save and we do not use transactions to get job state
 	if (readonly)
-		odbc->unlock(odbc);
+		SM_TRY_FAULT(odbc->commit(odbc));
 
 	return sm_ret_code_create(SMC_JOB_OK, NULL);
@@ -1056,9 +834,5 @@
 	if (stmt)
 		stmt->close_cursor(stmt);
-	if (!readonly)
-		odbc->rollback(odbc);
-	else
-		odbc->unlock(odbc);
-
+	odbc->rollback(odbc);
 	return sm_ret_code_create(SMC_JOB_NOT_FOUND, SMC_JOB_NOT_FOUND_STR);
 
@@ -1068,9 +842,5 @@
 	if (stmt)
 		stmt->close_cursor(stmt);
-	if (!readonly)
-		odbc->rollback(odbc);
-	else
-		odbc->unlock(odbc);
-
+	odbc->rollback(odbc);
 	smc_job_free(&job);
 	sm_list_free_user(*result, (sm_list_free_user_function) smc_job_free);
@@ -1082,9 +852,5 @@
 	if (stmt)
 		stmt->close_cursor(stmt);
-	if (!readonly)
-		odbc->rollback(odbc);
-	else
-		odbc->unlock(odbc);
-
+	odbc->rollback(odbc);
 	smc_job_free(&job);
 	sm_list_free_user(*result, (sm_list_free_user_function) smc_job_free);
@@ -1291,6 +1057,4 @@
 	SM_FREE(concrete->queue);
 	SM_FREE(concrete->nodes);
-	SM_FREE(concrete->domain);
-	SM_FREE(concrete->ext_info);
 	SM_FREE(concrete->project);
 
@@ -1369,5 +1133,86 @@
 		return SM_FAULT;
 
-	SM_TRY_FAULT(insert_acc_stmt->execute(insert_acc_stmt, "ssssssssstttibsdddssiibsss",
+	SM_TRY_FAULT(insert_acc_stmt->execute(insert_acc_stmt, "ssssssssstttibsdd",
+			this->id,
+			this->drms_id,
+			this->reservation_id,
+			this->submitted_jsdl,
+			this->jsdl,
+			this->subject,
+			this->mapped_user,
+			smc_job_state_str(this->state),
+			this->staging_fault,
+			FIELD2DB(this->submission_time),
+			FIELD2DB(this->start_time),
+			FIELD2DB(this->end_time),
+			FIELD2DB(this->exit_status),
+			FIELD2DB(this->core_dumped),
+			this->posix_signal_name,
+			FIELD2DB(this->cpu_usage),
+			FIELD2DB(this->mem_usage),
+			FIELD2DB(this->vmem_usage),
+			this->queue,
+			this->project,
+			FIELD2DB(this->walltime),
+			this->nodes));
+
+	SM_TRY_FAULT(odbc->commit(odbc));
+	return SM_OK;
+
+fault:
+	odbc->rollback(odbc);
+	return SM_FAULT;
+}
+
+static sm_status_ret_code_t
+smc_job_insert(smc_concrete_job_t this)
+{
+	SM_DEBUG_ENTER_STR(this->id);
+
+	SM_ASSERT(!this->in_transaction, "Job object inconsistent state");
+
+	if (odbc->begin_transaction(odbc) == SM_FAULT)
+		return SM_FAULT;
+
+	SM_TRY_FAULT(insert_stmt->execute(insert_stmt, "ssssssssstttibsdddssis",
+			this->id,
+			this->drms_id,
+			this->reservation_id,
+			this->submitted_jsdl,
+			this->jsdl,
+			this->subject,
+			this->mapped_user,
+			smc_job_state_str(this->state),
+			this->staging_fault,
+			FIELD2DB(this->submission_time),
+			FIELD2DB(this->start_time),
+			FIELD2DB(this->end_time),
+			FIELD2DB(this->exit_status),
+			FIELD2DB(this->core_dumped),
+			this->posix_signal_name,
+			FIELD2DB(this->cpu_usage),
+			FIELD2DB(this->mem_usage),
+			FIELD2DB(this->vmem_usage),
+			this->queue,
+			this->project,
+			FIELD2DB(this->walltime),
+			this->nodes));
+
+	SM_TRY_FAULT(odbc->commit(odbc));
+	return SM_OK;
+
+fault:
+	odbc->rollback(odbc);
+	return SM_FAULT;
+}
+
+static sm_status_ret_code_t
+smc_job_update(smc_concrete_job_t this)
+{
+	SM_DEBUG_ENTER_STR(this->id);
+
+	SM_ASSERT(this->in_transaction, "Job object inconsistent state");
+
+	SM_TRY_FAULT(update_stmt->execute(update_stmt, "ssssssssstttibsdddssisi",
 			this->id,
 			this->drms_id,
@@ -1392,27 +1237,27 @@
 			FIELD2DB(this->walltime),
 			this->nodes,
-			FIELD2DB(this->cancelled),
-			this->domain,
-			this->ext_info));
+			&this->serial
+			));
 
 	SM_TRY_FAULT(odbc->commit(odbc));
+	this->in_transaction = false;
 	return SM_OK;
 
 fault:
 	odbc->rollback(odbc);
+	this->in_transaction = false;
 	return SM_FAULT;
 }
 
 static sm_status_ret_code_t
-smc_job_insert(smc_concrete_job_t this)
+smc_job_move_to_acc(smc_concrete_job_t this)
 {
 	SM_DEBUG_ENTER_STR(this->id);
 
-	SM_ASSERT(!this->in_transaction, "Job object inconsistent state");
-
-	if (odbc->begin_transaction(odbc) == SM_FAULT)
-		return SM_FAULT;
-
-	SM_TRY_FAULT(insert_stmt->execute(insert_stmt, "ssssssssstttibsdddssisbss",
+	SM_ASSERT(this->in_transaction, "Job object inconsistent state");
+
+	SM_TRY_FAULT(delete_stmt->execute(delete_stmt, "s", this->id));
+
+	SM_TRY_FAULT(insert_acc_stmt->execute(insert_acc_stmt, "ssssssssstttibsdddssis",
 			this->id,
 			this->drms_id,
@@ -1436,52 +1281,5 @@
 			this->project,
 			FIELD2DB(this->walltime),
-			this->nodes,
-			FIELD2DB(this->cancelled),
-			this->domain,
-			this->ext_info));
-
-	SM_TRY_FAULT(odbc->commit(odbc));
-	return SM_OK;
-
-fault:
-	odbc->rollback(odbc);
-	return SM_FAULT;
-}
-
-static sm_status_ret_code_t
-smc_job_update(smc_concrete_job_t this)
-{
-	SM_DEBUG_ENTER_STR(this->id);
-
-	SM_ASSERT(this->in_transaction, "Job object inconsistent state");
-
-	SM_TRY_FAULT(update_stmt->execute(update_stmt, "ssssssssstttibsdddssisbssi",
-			this->id,
-			this->drms_id,
-			this->reservation_id,
-			this->submitted_jsdl,
-			this->jsdl,
-			this->subject,
-			this->mapped_user,
-			smc_job_state_str(this->state),
-			this->staging_fault,
-			FIELD2DB(this->submission_time),
-			FIELD2DB(this->start_time),
-			FIELD2DB(this->end_time),
-			FIELD2DB(this->exit_status),
-			FIELD2DB(this->core_dumped),
-			this->posix_signal_name,
-			FIELD2DB(this->cpu_usage),
-			FIELD2DB(this->mem_usage),
-			FIELD2DB(this->vmem_usage),
-			this->queue,
-			this->project,
-			FIELD2DB(this->walltime),
-			this->nodes,
-			FIELD2DB(this->cancelled),
-			this->domain,
-			this->ext_info,
-			&this->serial
-			));
+			this->nodes));
 
 	SM_TRY_FAULT(odbc->commit(odbc));
@@ -1495,50 +1293,4 @@
 }
 
-static sm_status_ret_code_t
-smc_job_move_to_acc(smc_concrete_job_t this)
-{
-	SM_DEBUG_ENTER_STR(this->id);
-
-	SM_ASSERT(this->in_transaction, "Job object inconsistent state");
-
-	SM_TRY_FAULT(delete_stmt->execute(delete_stmt, "s", this->id));
-
-	SM_TRY_FAULT(insert_acc_stmt->execute(insert_acc_stmt, "ssssssssstttibsdddssisbss",
-			this->id,
-			this->drms_id,
-			this->reservation_id,
-			this->submitted_jsdl,
-			this->jsdl,
-			this->subject,
-			this->mapped_user,
-			smc_job_state_str(this->state),
-			this->staging_fault,
-			FIELD2DB(this->submission_time),
-			FIELD2DB(this->start_time),
-			FIELD2DB(this->end_time),
-			FIELD2DB(this->exit_status),
-			FIELD2DB(this->core_dumped),
-			this->posix_signal_name,
-			FIELD2DB(this->cpu_usage),
-			FIELD2DB(this->mem_usage),
-			FIELD2DB(this->vmem_usage),
-			this->queue,
-			this->project,
-			FIELD2DB(this->walltime),
-			this->nodes,
-			FIELD2DB(this->cancelled),
-			this->domain,
-			this->ext_info));
-
-	SM_TRY_FAULT(odbc->commit(odbc));
-	this->in_transaction = false;
-	return SM_OK;
-
-fault:
-	odbc->rollback(odbc);
-	this->in_transaction = false;
-	return SM_FAULT;
-}
-
 static sm_ret_code_t
 smc_job_process_jsdl(smc_concrete_job_t this)
@@ -1567,20 +1319,17 @@
 		hpcpapp = jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication;
 
+		if (hpcpapp && !hpcpapp->jsdl_hpcpa__UserName) {
+			SM_TRY_NOT(hpcpapp->jsdl_hpcpa__UserName = sm_alloc_tracked_malloc(tracked, sizeof(_jsdl_hpcpa__UserName)));
+			SM_TRY_NOT(hpcpapp->jsdl_hpcpa__UserName->__item = sm_alloc_tracked_strdup(tracked, this->mapped_user));
+
+			sm_debug("Set jsdl-hpcpa:UserName with value from this->mapped_user (%s)", this->mapped_user);
+		}
 	}
 
 	/* Put user's home directory into jsdl-hpcpa:WorkingDirectory if not
 	 * already present. */
-	if (this->mapped_user && 
-		jsdl.jsdl__JobDescription->jsdl__Application &&
-		jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication &&
-		!hpcpapp->jsdl_hpcpa__UserName /* run only once */
-		 ) {
+	if (this->mapped_user && jsdl.jsdl__JobDescription->jsdl__Application) {
 		hpcpapp = jsdl.jsdl__JobDescription->jsdl__Application->jsdl_hpcpa__HPCProfileApplication;
 
-		SM_TRY_NOT(hpcpapp->jsdl_hpcpa__UserName = sm_alloc_tracked_malloc(tracked, sizeof(_jsdl_hpcpa__UserName)));
-		SM_TRY_NOT(hpcpapp->jsdl_hpcpa__UserName->__item = sm_alloc_tracked_strdup(tracked, this->mapped_user));
-
-		sm_debug("Set jsdl-hpcpa:UserName with value from this->mapped_user (%s)", this->mapped_user);
-	
 		/*if working directory is relative*/
 		if (hpcpapp && hpcpapp->jsdl_hpcpa__WorkingDirectory && hpcpapp->jsdl_hpcpa__WorkingDirectory->__item && hpcpapp->jsdl_hpcpa__WorkingDirectory->__item[0] != '/' ) {
@@ -1620,12 +1369,12 @@
 		}
 
-		#define MAX_QCG_ENV_VARS 4
 		/* add activity id as environment variable */
-		if (hpcpapp) { 
+		if (this->atc_token && hpcpapp) {
 			int i;
+
 			if (hpcpapp->__sizeEnvironment) {
 				struct jsdl_hpcpa__Environment_USCOREType *origEnv = hpcpapp->jsdl_hpcpa__Environment;
 
-				SM_TRY_NOT(hpcpapp->jsdl_hpcpa__Environment = sm_alloc_tracked_calloc(tracked, hpcpapp->__sizeEnvironment + MAX_QCG_ENV_VARS /*make room for X509_USER_PROXY and friends*/, sizeof(struct jsdl_hpcpa__Environment_USCOREType)));
+				SM_TRY_NOT(hpcpapp->jsdl_hpcpa__Environment = sm_alloc_tracked_calloc(this->tracked, hpcpapp->__sizeEnvironment + 2 /*make room for X509_USER_PROXY*/, sizeof(struct jsdl_hpcpa__Environment_USCOREType)));
 
 				for (i=0; i < hpcpapp->__sizeEnvironment; i++)
@@ -1633,5 +1382,5 @@
 
 			} else {
-				SM_TRY_NOT(hpcpapp->jsdl_hpcpa__Environment = sm_alloc_tracked_calloc(tracked, MAX_QCG_ENV_VARS /*make room for X509_USER_PROXY and friends*/, sizeof(struct jsdl_hpcpa__Environment_USCOREType)));
+				SM_TRY_NOT(hpcpapp->jsdl_hpcpa__Environment = sm_alloc_tracked_calloc(this->tracked, 2 /*make room for X509_USER_PROXY*/, sizeof(struct jsdl_hpcpa__Environment_USCOREType)));
 			}
 
@@ -1650,5 +1399,5 @@
 			SM_ASSERT(SM_VALUE_IS_BYTES(this->atc_token[1]),"Invalid X509 proxy atc_token");
 
-			proxy_file_name = sm_alloc_tracked_asprintf(tracked, "%s/.x509.proxy.%s", working_dir, this->id);
+			proxy_file_name = sm_alloc_tracked_asprintf(this->tracked, "%s/.x509.proxy.%s", working_dir, this->id);
 
 			sm_info("saving X509 user proxy into %s", proxy_file_name);
@@ -1667,42 +1416,14 @@
 
 		}
-
-		if (smc_redirect_stdouterr) {
-			char *stdout_name = "stdout";
-			char *stderr_name = "stderr";
-			int i = 0;
-
-			sm_debug("Requesting redirection of stdout/stderr files"); 
-
-			if (hpcpapp->jsdl_hpcpa__Output)
-				stdout_name = hpcpapp->jsdl_hpcpa__Output->__item;
-
-			if (hpcpapp->jsdl_hpcpa__Error)
-				stderr_name = hpcpapp->jsdl_hpcpa__Error->__item;
-
-			sm_debug("stdout=%s, stderr=%s", stdout_name, stderr_name);
-
-			hpcpapp->jsdl_hpcpa__Output = NULL;
-			hpcpapp->jsdl_hpcpa__Error = NULL;
-
-			hpcpapp->jsdl_hpcpa__Environment[hpcpapp->__sizeEnvironment].__item = stdout_name;
-			hpcpapp->jsdl_hpcpa__Environment[hpcpapp->__sizeEnvironment].name = "QCG_STDOUT";
-			hpcpapp->__sizeEnvironment++;
-
-			hpcpapp->jsdl_hpcpa__Environment[hpcpapp->__sizeEnvironment].__item = stderr_name;
-			hpcpapp->jsdl_hpcpa__Environment[hpcpapp->__sizeEnvironment].name = "QCG_STDERR";
-			hpcpapp->__sizeEnvironment++;
-		}
-	}
+		
+		sm_value_free(&this->atc_token);
+	}
+
 	/* Get ReservationId from JSDL and save into this->reservation_id */
-	if (!this->reservation_id && jsdl.jsdl__JobDescription->jsdl__Resources && 
-		jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation &&
-		jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier) {
+	if (!this->reservation_id && jsdl.jsdl__JobDescription->jsdl__Resources && jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation) {
 		sm_status_ret_code_t status;
 		const char *tmp = NULL;
 
-		sm_debug("parsing reservation EPR");
-
-		status = smc_parse_reservation_epr(jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier, &tmp);
+		status = smc_parse_reservation_epr(&jsdl.jsdl__JobDescription->jsdl__Resources->jsdl_qcg_comp_ares__Reservation->ReservationIdentifier, &tmp);
 
 		/* Invalid ReservationId format */
@@ -1761,5 +1482,5 @@
 			this->submission_time = timetm();
 		}
-		if (!this->start_time_set) { /* although it may not be true from accounting perspective its safer to assume that job was started */
+		if (!this->start_time_set) {
 			this->start_time_set = true;
 			this->start_time = timetm();
@@ -1770,28 +1491,4 @@
 		}
 	}
-}
-
-static void remove_proxy(smc_concrete_job_t this)
-{
-	_jsdl__JobDefinition *jsdl = NULL;
-	const char *working_directory = NULL;
-	char *proxy_file_name = NULL;
-
-	assert(this->jsdl);
-
-	if (!(jsdl = smc_job_get_jsdl_parsed(this))) {
-		sm_error("Failed to get parsed JSDL");
-		return;
-	}
-
-        if (!(working_directory = smc_jsdl_get_working_dir(jsdl, SM_FALSE))) {
-		sm_error("Failed to get working directory");
-		return;
-	}
-
-	sm_alloc_tracked_asprintf(this->tracked, "%s/.x509.proxy.%s", working_directory, this->id);
-
-	sm_debug("Trying to delete proxy file %s", proxy_file_name);
-	(void)unlink(proxy_file_name); /* here we do a blind call, but otherwise we would have to extend database */
 }
 
@@ -1844,5 +1541,4 @@
 			this->mapped_user, mktime(&this->submission_time), mktime(&this->start_time), mktime(&this->end_time),
 			this->exit_status, this->cpu_usage, this->mem_usage, this->vmem_usage, this->queue, this->project, this->walltime, this->nodes, NULL);
-			//remove_proxy(this);
 			break;
 		case SMC_CANCELLED:
@@ -1851,5 +1547,4 @@
 			this->submitted_jsdl, this->jsdl, this->subject,
 			this->mapped_user, mktime(&this->submission_time), mktime(&this->start_time), mktime(&this->end_time), NULL);
-			//remove_proxy(this);
 			break;
 		case SMC_FAILED:
@@ -1858,5 +1553,4 @@
 			this->subject, this->mapped_user, this->staging_fault, mktime(&this->submission_time), mktime(&this->start_time), mktime(&this->end_time),
 			this->core_dumped, this->posix_signal_name, NULL);
-			//remove_proxy(this);
 			break;
 	}
@@ -1884,5 +1578,5 @@
 		/* Stage-in -> Queued -> Executing -> Failed */
 		ENTER_STATE(SMC_QUEUED);
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_FAILED);
 
@@ -1891,5 +1585,5 @@
 		/* Stage-in -> Queued -> Executing -> Finished */
 		ENTER_STATE(SMC_QUEUED);
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_FINISHED);
 
@@ -1897,5 +1591,5 @@
 
 		/* Queued -> Executing -> Failed */
-		//ENTER_STATE(SMC_EXECUTING); although requsted by BES state model do not emit fake states
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_FAILED);
 
@@ -1903,5 +1597,5 @@
 
 		/* Queued -> Executing -> Finished */
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_FINISHED);
 
@@ -1915,5 +1609,5 @@
 
 		/* Queued -> Executing -> Suspended */
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_SUSPENDED);
 
@@ -1922,5 +1616,5 @@
 		/* Held -> Queued -> Executing -> Failed */
 		ENTER_STATE(SMC_QUEUED);
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_FAILED);
 
@@ -1929,5 +1623,5 @@
 		/* Stage-in -> Queued -> Executing -> Stage-out */
 		ENTER_STATE(SMC_QUEUED);
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_STAGE_OUT);
 
@@ -1936,5 +1630,5 @@
 		/* NEW -> Queued -> Executing -> Stage-out */
 		ENTER_STATE(SMC_QUEUED);
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_STAGE_OUT);
 
@@ -1943,5 +1637,5 @@
 		/* NEW -> Queued -> Executing -> Finished */
 		ENTER_STATE(SMC_QUEUED);
-		//ENTER_STATE(SMC_EXECUTING);
+		ENTER_STATE(SMC_EXECUTING);
 		ENTER_STATE(SMC_FINISHED);
 
@@ -1996,11 +1690,10 @@
 	}
 
-	if (this->previous_state != this->state) {
-		smc_job_process_state_change(this);
-	}
-
 	if (save_func(this) != SM_OK)
 		return sm_ret_code_create(SMC_JOB_INTERNAL_FAULT, "Failed to save job object to database");
 
+	if (this->previous_state != this->state)
+		smc_job_process_state_change(this);
+
 	this->modified = false;
 	this->error = sm_ret_code_create(SMC_JOB_INTERNAL_FAULT, "Cannot save the same job object twice. You need to fetch a new one.");
@@ -2016,5 +1709,5 @@
 	SM_DEBUG_ENTER();
 
-	odbc->lock(odbc); // do not use transaction as we only call one statement
+	odbc->begin_transaction(odbc);
 
 	SM_TRY_NOT_OK(count_stmt->execute(count_stmt, NULL));
@@ -2023,5 +1716,5 @@
 
 	count_stmt->close_cursor(count_stmt);
-	odbc->unlock(odbc);
+	odbc->commit(odbc);
 
 	SM_ASSERT(result <= INT_MAX, "smc_job_count needs refactoring ;-)");
@@ -2034,5 +1727,4 @@
 	return -1;
 }
-
 
 #ifdef TEST
@@ -2081,9 +1773,4 @@
 urn:uuid:9b7183a3-420e-45b7-863e-915dc380594d</qcg-comp-ares:ReservationId></wsa5:ReferenceParameters>\
 </jsdl-qcg-comp-ares:ReservationIdentifier></jsdl-qcg-comp-ares:Reservation></jsdl:Resources></jsdl:JobDescription></jsdl:JobDefinition>";
-
-static const char *info_est_time = "<ActivityInfo xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/factory\"><EstimatedStartTime>2016-03-03T23:35:47</EstimatedStartTime></ActivityInfo>";
-static const char *info_empty = "<qcf:ActivityInfo xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/factory\" xmlns:qcf=\"http://schemas.qoscosgrid.org/comp/2011/04/factory\"></qcf:ActivityInfo>" ;
-static const char *info_running = "<ActivityInfo xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/factory\"><StartTime>2013-05-14T23:34:41</StartTime><ExecutionNodes>grass1.man.poznan.pl:1</ExecutionNodes><MemoryUsageInMB>2</MemoryUsageInMB><Efficiency>0</Efficiency></ActivityInfo>";
-static const char *info_est_time_normalized = "<qcf:ActivityInfo xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/factory\" xmlns:qcf=\"http://schemas.qoscosgrid.org/comp/2011/04/factory\"><qcf:EstimatedStartTime>2016-03-03T22:35:47Z</qcf:EstimatedStartTime></qcf:ActivityInfo>";
 
 static void
@@ -2130,7 +1817,4 @@
 	job->set_walltime(job, 120);
 	job->set_nodes(job, "hosta:1|hostb:2");
-	job->set_cancelled(job, SM_TRUE);
-	job->set_domain(job, "plgrid");
-	job->set_ext_info(job, info_running);
 
 	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
@@ -2165,7 +1849,4 @@
 	assert(job->get_walltime(job) == 120);
 	assert(!strcmp(job->get_nodes(job), "hosta:1|hostb:2"));
-	assert(job->get_cancelled(job));
-	assert(!strcmp(job->get_domain(job), "plgrid"));
-	assert(!strcmp(job->get_ext_info(job), info_running));
 	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
 
@@ -2205,7 +1886,4 @@
 	assert(job->get_walltime(job) == 120);
 	assert(!strcmp(job->get_nodes(job), "hosta:1|hostb:2"));
-	assert(job->get_cancelled(job));
-	assert(!strcmp(job->get_domain(job), "plgrid"));
-	assert(!strcmp(job->get_ext_info(job), info_running));
 	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
 
@@ -2242,7 +1920,4 @@
 	assert(job->get_walltime(job) == 120);
 	assert(!strcmp(job->get_nodes(job), "hosta:1|hostb:2"));
-	assert(job->get_cancelled(job));
-	assert(!strcmp(job->get_domain(job), "plgrid"));
-	assert(!strcmp(job->get_ext_info(job), info_running));
 	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
 
@@ -2252,136 +1927,4 @@
 	SM_FREE(tmp);
 }
-
-
-static void
-test_clear_est_time(void)
-{
-	smc_job_t job = NULL;
-	char *tmp = NULL;
-	sm_ret_code_t ret;
-	sm_list_t result = NULL;
-	time_t now;
-	struct tm now_tm;
-	struct tm db_tm;
-
-	SM_DEBUG_ENTER();
-
-	now = time(NULL);
-	now_tm = *localtime(&now);
-
-	assert(smc_job_count() == 0);
-
-	ret = smc_job_get_active_readonly(&result);
-	assert(!ret.code);
-	assert(sm_list_count(result) == 0);
-
-	sm_debug("Creating");
-	job = smc_job_create();
-
-	job->set_id(job, (tmp = smc_generate_id(NULL, NULL)));
-	job->set_drms_id(job, "100");
-	job->set_submitted_jsdl(job, jsdl);
-	job->set_jsdl(job, jsdl);
-	job->set_subject(job, "subject");
-	job->set_mapped_user(job, "root");
-	job->set_state(job, SMC_QUEUED);
-	job->set_start_time(job, now_tm);
-	job->set_exit_status(job, 100);
-	job->set_core_dumped(job, true);
-	job->set_posix_signal_name(job, "SIGKILL");
-	job->set_cpu_usage(job, 5);
-	job->set_mem_usage(job, 10);
-	job->set_vmem_usage(job, 15);
-	job->set_queue(job, "default");
-	job->set_project(job, "Manhattan");
-	job->set_walltime(job, 120);
-	job->set_nodes(job, "hosta:1|hostb:2");
-	job->set_cancelled(job, SM_TRUE);
-	job->set_domain(job, "plgrid");
-	job->set_ext_info(job, info_est_time_normalized);
-
-	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
-
-	sm_debug("Saving");
-	job->save(job);
-	assert(smc_job_count() == 1);
-	smc_job_free(&job);
-
-	/* Get for potential modifications. */
-	sm_debug("Getting");
-	ret = smc_job_get(tmp, &result);
-	assert(!ret.code);
-	assert(sm_list_count(result) == 1);
-
-	job = (smc_job_t) result->data;
-	assert(!strcmp(tmp, job->get_id(job)));
-	assert(!strcmp("100", job->get_drms_id(job)));
-	assert(!strcmp(jsdl, job->get_submitted_jsdl(job)));
-	/* JSDL is modified so we cannot do a strcmp() here. */
-	assert(!strcmp("subject", job->get_subject(job)));
-	assert(!strcmp("root", job->get_mapped_user(job)));
-	assert(job->get_state(job) == SMC_QUEUED);
-	assert(job->get_exit_status(job) == 100);
-	assert(job->get_core_dumped(job) == true);
-	assert(!strcmp("SIGKILL", job->get_posix_signal_name(job)));
-	assert(job->get_cpu_usage(job) == 5);
-	assert(job->get_mem_usage(job) == 10);
-	assert(job->get_vmem_usage(job) == 15);
-	assert(!strcmp(job->get_queue(job), "default"));
-	assert(!strcmp(job->get_project(job), "Manhattan"));
-	assert(job->get_walltime(job) == 120);
-	assert(!strcmp(job->get_nodes(job), "hosta:1|hostb:2"));
-	assert(job->get_cancelled(job));
-	assert(!strcmp(job->get_domain(job), "plgrid"));
-	assert(!strcmp(job->get_ext_info(job), info_est_time_normalized));
-	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
-
-	job->set_state(job, SMC_EXECUTING); 
-
-	/* This should do nothing. */
-	sm_debug("Saving with modifications");
-	job->save(job);
-	assert(smc_job_count() == 1);
-
-	sm_list_free_user(result, (sm_list_free_user_function) smc_job_free);
-
-	/* Get as readonly. */
-	sm_debug("Getting read only");
-	ret = smc_job_get_by_drms_id_readonly("100", &job);
-	assert(!ret.code);
-
-	assert(!strcmp(tmp, job->get_id(job)));
-	assert(!strcmp("100", job->get_drms_id(job)));
-	assert(!strcmp(jsdl, job->get_submitted_jsdl(job)));
-	/* JSDL is modified so we cannot do a strcmp() here. */
-	assert(!strcmp("subject", job->get_subject(job)));
-	assert(!strcmp("root", job->get_mapped_user(job)));
-	assert(job->get_state(job) == SMC_EXECUTING);
-
-	db_tm = job->get_start_time(job);
-	assert(mktime(&db_tm) == now);
-
-	assert(job->has_exit_status(job));
-	assert(job->get_exit_status(job) == 100);
-	assert(job->has_core_dumped(job));
-	assert(job->get_core_dumped(job) == true);
-	assert(!strcmp("SIGKILL", job->get_posix_signal_name(job)));
-	assert(job->get_cpu_usage(job) == 5);
-	assert(job->get_mem_usage(job) == 10);
-	assert(job->get_vmem_usage(job) == 15);
-	assert(!strcmp(job->get_queue(job), "default"));
-	assert(!strcmp(job->get_project(job), "Manhattan"));
-	assert(job->get_walltime(job) == 120);
-	assert(!strcmp(job->get_nodes(job), "hosta:1|hostb:2"));
-	assert(job->get_cancelled(job));
-	assert(!strcmp(job->get_domain(job), "plgrid"));
-        sm_info("%s = %s", info_empty, job->get_ext_info(job));
-	assert(!strcmp(job->get_ext_info(job), info_empty));
-	assert(!strcmp("9b7183a3-420e-45b7-863e-915dc380594d", job->get_reservation_id(job)));
-
-	smc_job_free(&job);
-	assert(smc_job_count() == 1);
-}
-
 
 static void
@@ -2453,10 +1996,4 @@
 		job->set_state(job, SMC_QUEUED);
 		job->set_nodes(job, "hosta:1|hostb:2");
-		job->set_domain(job, "plgrid");
-		job->set_ext_info(job, info_est_time);
-		job->set_ext_info(job, info_empty);
-		assert(!strcmp(job->get_ext_info(job), info_est_time_normalized));
-		if (states[i] == SMC_CANCELLED)
-			job->set_cancelled(job, SM_TRUE);
 
 		job->save(job);
@@ -2468,8 +2005,5 @@
 		assert(!strcmp(tmp, job->get_id(job)));
 
-		if (states[i] == SMC_CANCELLED)
-			job->set_state(job, SMC_FAILED);
-		else
-			job->set_state(job, states[i]);
+		job->set_state(job, states[i]);
 
 		job->save(job);
@@ -2483,13 +2017,8 @@
 		ret = smc_job_get_by_drms_id_readonly(drms_id, &job);
 		assert(!ret.code);
+
 		assert(!strcmp(tmp, job->get_id(job)));
 		assert(job->get_state(job) == states[i]);
 		assert(!strcmp(job->get_nodes(job), "hosta:1|hostb:2"));
-		assert(!strcmp(job->get_domain(job), "plgrid"));
-		assert(!strcmp(job->get_ext_info(job), info_empty));
-		if (states[i] == SMC_CANCELLED)
-			assert(job->has_cancelled(job) && job->get_cancelled(job));
-		else
-			assert(!job->has_cancelled(job));
 
 		smc_job_free(&job);
@@ -2505,7 +2034,7 @@
 
 	assert(sm_library_setup() == SM_OK);
-	assert(sm_log_init_str(NULL, "INFO") == SM_OK);
-
-	db = sm_odbc_connect("qcg-comp", "qcg-comp", "qcg-comp");
+	assert(sm_log_init_str(NULL, "DEBUG") == SM_OK);
+
+	db = sm_odbc_connect("qcg_comp_test", "qcg_comp", "qcg_comp");
 	if (!db) {
 		sm_notice("Could not connect to database. Prepare the test database first.");
@@ -2521,7 +2050,4 @@
 	test_prepare();
 	test_add_username_to_jsdl();
-	
-	test_prepare();
-	test_clear_est_time();
 
 	test_prepare();
Index: trunk/src/modules/qcg_comp_service/identifiers.h
===================================================================
--- trunk/src/modules/qcg_comp_service/identifiers.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/identifiers.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SCM_IDENTIFIERS_H
Index: trunk/src/modules/qcg_comp_service/job.h
===================================================================
--- trunk/src/modules/qcg_comp_service/job.h	(revision 963)
+++ trunk/src/modules/qcg_comp_service/job.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 #ifndef __SMC_JOB_H
 #define __SMC_JOB_H
@@ -97,5 +90,4 @@
 	smc_job_reservation_info_getter_function get_reservation_info;
 	smc_job_string_getter_function get_submitted_jsdl;
-	smc_job_jsdl_parsed_getter_function get_submitted_jsdl_parsed;
 	smc_job_string_getter_function get_jsdl;
 	smc_job_jsdl_parsed_getter_function get_jsdl_parsed;
@@ -120,8 +112,4 @@
 	smc_job_string_getter_function get_nodes;
 	smc_job_value_getter_function get_atc_token;
-	smc_job_bool_getter_function get_cancelled;
-	smc_job_bool_getter_function has_cancelled;
-	smc_job_string_getter_function get_domain;
-	smc_job_string_getter_function get_ext_info;
 
 	smc_job_string_setter_function set_id;
@@ -135,5 +123,4 @@
 	smc_job_string_setter_function set_staging_fault;
 	smc_job_time_setter_function set_start_time;
-	smc_job_time_setter_function set_end_time;
 	smc_job_byte_setter_function set_exit_status;
 	smc_job_bool_setter_function set_core_dumped;
@@ -147,7 +134,4 @@
 	smc_job_string_setter_function set_nodes;
 	smc_job_value_setter_function set_atc_token;
-	smc_job_bool_setter_function set_cancelled;
-	smc_job_string_setter_function set_domain;
-	smc_job_string_setter_function set_ext_info;
 
 	smc_job_bool_getter_function is_readonly;
Index: trunk/src/modules/qcg_comp_service/session_process.c
===================================================================
--- trunk/src/modules/qcg_comp_service/session_process.c	(revision 963)
+++ trunk/src/modules/qcg_comp_service/session_process.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -80,16 +73,7 @@
 
 static unsigned int session_process_timeout = 10;
-static unsigned int session_process_maxlifetime = 240; /* in hours, 10 days */
-static unsigned int session_process_maxlifetime_with_drms_errors = 900; /* in seconds, 15 minutes */
 static unsigned int submitted_jobs_hash_table = 4096;
 static unsigned int job_status_polling_period = 10;
-static unsigned int orphaned_jobs_polling_period = 45;
-static unsigned int max_job_missing_time = 600; /* in seconds, 5 minutes - TODO: make it configurable */
-
-static time_t session_process_start_time = 0;
-static volatile time_t last_drms_failure_time = 0;
 static SM_BOOL job_status_full_polling = SM_TRUE;
-static SM_BOOL use_scratch = SM_FALSE;
-static SM_BOOL session_process_exiting = SM_FALSE;
 
 static sm_conf_ctxt_t conf;
@@ -105,9 +89,6 @@
 
 static xmlHashTablePtr submitted_jobs;
-static xmlHashTablePtr orphaned_jobs;
-static xmlHashTablePtr missing_jobs;
-
-static sm_mutex_t jobs_map_lock;
-static sm_cond_t jobs_map_cond;
+static sm_mutex_t submitted_jobs_lock;
+static sm_cond_t submitted_jobs_cond;
 
 static sm_mutex_t staging_in_progress_lock;
@@ -154,6 +135,4 @@
 	sm_value_t *params = NULL;
 	sm_value_t *subresult = NULL;
-	sm_value_t *status_params = NULL;
-	sm_value_t *status_result = NULL;
 	smc_rsvn_t rsvn = NULL;
 	const char *subject = NULL;
@@ -186,26 +165,8 @@
 	rsvn->set_mapped_user(rsvn, username);
 	rsvn->set_submitted_ardl(rsvn, submitted_ardl);
-
 	rsvn->set_ardl(rsvn, ardl);
-	
-	/* parse reservation transform it into "canonical" form */
-	ret = rsvn->process_ardl(rsvn);
-
-	if (!SM_RET_CODE_OK(ret)) {
-		response = sm_value_create(1, SM_VALUE_RET_CODE, qcg_comp_ares_InvalidRequestMessageFault, ret.string);
-		goto fault;
-	}
-
-	/* validate reservation against local policies */
-	ret = rsvn->verify_policy(rsvn);
-
-	if (!SM_RET_CODE_OK(ret)) {
-		response = sm_value_create(1, SM_VALUE_RET_CODE, qcg_comp_ares_NotAuthorizedFault, ret.string);
-		goto fault;
-	}
 
 	/* We use rsvn->get_ardl to get more "canonical" form of ARDL. */
 	SM_TRY_NOT(params = sm_value_create(1, SM_VALUE_STRING, rsvn->get_ardl(rsvn)));
-
 	subresult = reservation_module->create((sm_module_t) reservation_module, params);
 	if (!subresult) {
@@ -235,36 +196,4 @@
 		rsvn->set_drms_id(rsvn, drms_id);
 
-		/* get reserved nodes */
-		SM_TRY_NOT(status_params = sm_value_create(1, SM_VALUE_STRING, drms_id));
-		status_result = reservation_module->get_status((sm_module_t) reservation_module, status_params);
-		if (status_result && SM_VALUE_RET_CODE_OK(status_result[0]) && sm_value_count(status_result[1]->varray) > 0) {
-			sm_value_t *reserved_hosts = NULL;
-			char *tmp_rhost_list = NULL;
-			int i, reserved_hosts_count, slen = 0;
-
-			reserved_hosts = status_result[1]->varray;
-			reserved_hosts_count = sm_value_count(reserved_hosts);
-
-			for (i=0 ; i < reserved_hosts_count; i++) {
-				slen += strlen(reserved_hosts[i]->vstring) + 1;
-			}
-
-			SM_TRY_NOT(tmp_rhost_list = sm_malloc(slen));
-			tmp_rhost_list[0] = '\0';
-
-			for (i=0 ; i < reserved_hosts_count - 1; i++) {
-				strlcat(tmp_rhost_list, reserved_hosts[i]->vstring, slen);
-				strlcat(tmp_rhost_list, "+", slen);
-			}
-			strlcat(tmp_rhost_list, reserved_hosts[reserved_hosts_count - 1]->vstring, slen);
-
-			sm_info("Reserved nodes = %s", tmp_rhost_list);
-
-			rsvn->set_nodes(rsvn, tmp_rhost_list);
-			SM_FREE(tmp_rhost_list);
-		} else {
-			sm_error("Failed to get reservation status: %s", drms_id);
-		}
-
 		ret = rsvn->save(rsvn);
 		if (ret.code) {
@@ -283,6 +212,4 @@
 	sm_value_free(&req);
 	sm_value_free(&params);
-	sm_value_free(&status_params);
-	sm_value_free(&status_result);
 	smc_rsvn_free(&rsvn);
 	return;
@@ -292,7 +219,4 @@
 	sm_value_free(&req);
 	sm_value_free(&params);
-	sm_value_free(&status_params);
-	sm_value_free(&status_result);
-
 	smc_rsvn_free(&rsvn);
 	if (!response)
@@ -561,15 +485,15 @@
 			}
 
-			if(ds->jsdl_comp_staging__FileMode) {
+			if(ds->qcgcomp1__FileMode) {
 				mode_t mode;
 				char *endptr;
 
-				mode = strtol(ds->jsdl_comp_staging__FileMode, &endptr, 8);
-
-				if(!(ds->jsdl_comp_staging__FileMode[0]!='\0' && endptr[0]=='\0') ||
-						ds->jsdl_comp_staging__FileMode[0]=='\0')
+				mode = strtol(ds->qcgcomp1__FileMode, &endptr, 8);
+
+				if(!(ds->qcgcomp1__FileMode[0]!='\0' && endptr[0]=='\0') ||
+						ds->qcgcomp1__FileMode[0]=='\0')
 					mode = 0644;
 
-				sm_debug("Setting mode %o (was %s) for file %s", mode, ds->jsdl_comp_staging__FileMode, local_file_name);
+				sm_debug("Setting mode %o (was %s) for file %s", mode, ds->qcgcomp1__FileMode, local_file_name);
 
 				if(chmod(local_file_name, mode) != 0) {
@@ -646,5 +570,5 @@
 			if (!skip_file && (fclose(fhandle) != 0)) {
 				snprintf(errmsg, sizeof(errmsg), "Writing to file %s failed: %s", local_file_name, strerror(errno));
-				sm_notice("%s", errmsg);
+				sm_debug("%s", errmsg);
 				response = sm_value_create(1, SM_VALUE_RET_CODE, qcg_comp_staging_StagingFault, errmsg);
 				goto fault;
@@ -717,7 +641,5 @@
 	FILE *fhandle = NULL;
 	int i;
-	off_t off = 0;
-	unsigned long long max_read = 2147483648; /* 2GB*/
-	unsigned long long final_read = 0;
+	off_t off;
 
 	SM_DEBUG_ENTER();
@@ -749,9 +671,8 @@
 				local_file_name = ds->jsdl__FileName;
 
-			if(ds->jsdl_comp_staging__Offset)
-				off = *(ds->jsdl_comp_staging__Offset);
-
-			if (ds->jsdl_comp_staging__Size)
-				max_read = *(ds->jsdl_comp_staging__Size);
+			if(ds->qcgcomp1__Offset)
+				off = *(ds->qcgcomp1__Offset);
+			else
+				off = 0;
 
 			if (!local_file_name) {
@@ -822,9 +743,6 @@
 			}
 
-			final_read = (unsigned long long) MAX( ((long long)st.st_size-(long long)off), 0 );
-			final_read = MIN(final_read, max_read);
-
-			file_info = sm_value_create(2, SM_VALUE_STRING, ds->jsdl__Target->jsdl__URI, SM_VALUE_UINT64, final_read);
-			sm_info("File %s has size %llu, offset = %llu,  read size = %llu", ds->jsdl__Target->jsdl__URI, (unsigned long long) st.st_size, (unsigned long long) off,  final_read);
+			file_info = sm_value_create(2, SM_VALUE_STRING, ds->jsdl__Target->jsdl__URI, SM_VALUE_UINT64, (unsigned long long) st.st_size-off);
+			sm_debug("File %s has size %llu", ds->jsdl__Target->jsdl__URI, (unsigned long long) st.st_size-off);
 
 			if (!file_info) {
@@ -927,8 +845,8 @@
 			}
 
-			if(ds->jsdl_comp_staging__Offset) {
-				sm_debug("Skipping %llu bytes in file %s", (unsigned long long)*(ds->jsdl_comp_staging__Offset), local_file_name);
-
-				if(fseek(fhandle, *(ds->jsdl_comp_staging__Offset), SEEK_SET) != 0) {
+			if(ds->qcgcomp1__Offset) {
+				sm_debug("Skipping %u bytes in file %s", *(ds->qcgcomp1__Offset), local_file_name);
+
+				if(fseek(fhandle, *(ds->qcgcomp1__Offset), SEEK_SET) != 0) {
 					snprintf(errmsg, sizeof(errmsg), "Unable to seek in file stream %s: %s", local_file_name, strerror(errno));
 					sm_debug("%s", errmsg);
@@ -1058,107 +976,4 @@
 		sm_error("Failed to send StageOut response");
 }
-
-static void
-handle_GetDRMS(int fd)
-{
-	sm_value_t *empty = NULL;
-	sm_value_t *subresult = NULL;
-	sm_value_t *response = NULL;
-
-	SM_DEBUG_ENTER();
-
-	if (smc_icomm_receive_GetDRMS(fd, &empty) != SM_OK) {
-		sm_error("Failed to receive GetDRMS request");
-		goto fault;
-	}
-
-	if (!submission_module) {
-		response = sm_value_create(1, SM_VALUE_RET_CODE,  SUBMISSION_INTERNAL_FAULT, "No submission module loaded");
-		goto fault;
-	}
-
-	subresult = submission_module->get_drms((sm_module_t) submission_module);
-	if (!subresult) {
-		sm_error("Submission module didn't return any result");
-		goto fault;
-	}
-
-	if (smc_icomm_respond_GetDRMS(fd, subresult) != SM_OK) {
-		sm_error("Failed to send GetDRMS response");
-		goto fault;
-	}
-
-	sm_value_free(&empty);
-	return;
-
-fault:
-	sm_value_free(&empty);
-	if (!response)
-		response = sm_value_create(1, SM_VALUE_RET_CODE, SUBMISSION_INTERNAL_FAULT, "Internal fault in session process");
-	if (smc_icomm_respond_GetDRMS(fd, response) != SM_OK)
-		sm_error("Failed to send GetDRMS response");
-}
-
-static void
-handle_GetDRMSInfos(int fd)
-{
-	sm_value_t *params = NULL;
-	sm_value_t *response = NULL;
-	char *drms_type = NULL;
-        SM_BOOL ext_info;
-        char *contained_resources = NULL;
-        sm_list_t factory_attributes = NULL;
-	sm_list_t ii = NULL;
-
-	SM_DEBUG_ENTER();
-
-	sm_log_set_log_ctxt("monitoring");
-
-	if (smc_icomm_receive_GetDRMSInfos(fd, &params) != SM_OK) {
-		sm_error("Failed to receive GetDRMSInfos request");
-		goto fault;
-	}
-        
-	assert(sm_value_count(params) == 2);
-        assert(SM_VALUE_IS_STRING(params[0]));
-        assert(SM_VALUE_IS_BOOL(params[1]));
-
-
-	drms_type = params[0]->vstring;
-        ext_info  = params[1]->vbool;
-
-	sm_info("Querying DRMS for hosts, queues, jobs statuses (extended=%d)", ext_info);
-        
-        smc_get_job_stats(drms_type, ext_info); /* this function updates the database, thus there is no return value */
-
-        SM_TRY_FAULT(smc_get_factory_attr(drms_type, &contained_resources, &factory_attributes));
-
-
-	SM_TRY_NOT(response = sm_value_create(2, SM_VALUE_RET_CODE, bes_factory_OK, SM_VALUE_STRING | SM_VALUE_DONT_COPY_FLAG,  contained_resources));
-
-        for (ii = factory_attributes ; ii; ii = ii->next) {
-		SM_TRY_NOT(sm_value_append(&response, 1, SM_VALUE_STRING | SM_VALUE_DONT_COPY_FLAG, ((sm_value_t *)ii->data)[0]->vstring));
-	}
-
-	sm_debug("returning %d values", (int)sm_value_count(response));
-
-	if (smc_icomm_respond_GetDRMSInfos(fd, response) != SM_OK) {
-		sm_error("Failed to send GetDRMS response");
-		goto fault;
-	}
-
-	sm_list_free(factory_attributes, SM_FALSE);
-	sm_value_free(&params);
-	return;
-
-fault:
-	sm_list_free(factory_attributes, SM_FALSE);
-	sm_value_free(&params);
-	if (!response)
-		response = sm_value_create(1, SM_VALUE_RET_CODE, SUBMISSION_INTERNAL_FAULT, "Internal fault in session process");
-	if (smc_icomm_respond_GetDRMSInfos(fd, response) != SM_OK)
-		sm_error("Failed to send GetDRMS response");
-}
-
 
 static void
@@ -1262,11 +1077,11 @@
 		SM_TRY_NOT(sm_value_append(&result, 1, SM_VALUE_STRING, job->get_id(job)));
 
-		sm_mutex_lock(&jobs_map_lock);
+		sm_mutex_lock(&submitted_jobs_lock);
 		if (xmlHashAddEntry(submitted_jobs, (xmlChar *) drms_id, state) != 0) {
-			sm_mutex_unlock(&jobs_map_lock);
+			sm_mutex_unlock(&submitted_jobs_lock);
 			goto fault;
 		}
-		sm_cond_broadcast(&jobs_map_cond);
-		sm_mutex_unlock(&jobs_map_lock);
+		sm_cond_broadcast(&submitted_jobs_cond);
+		sm_mutex_unlock(&submitted_jobs_lock);
 
 		/* This should not be freed from now on. */
@@ -1307,6 +1122,6 @@
 
 static struct sm_transport_s init_transport = {
-		.transport_malloc = (sm_transport_malloc_function)transport_malloc,
-		.transport_strdup = (sm_transport_strdup_function)transport_strdup,
+		.transport_malloc = transport_malloc,
+		.transport_strdup = transport_strdup,
 		.data = NULL
 };
@@ -1329,5 +1144,5 @@
 	}
 
-	fun_result = GetFiles((rsync_transport_t)&transport, req[0]->vstring, &files);
+	fun_result = GetFiles(&transport, req[0]->vstring, &files);
 	SM_TRY_NOT(response = sm_value_create(1, SM_VALUE_RET_CODE, fun_result, "GetFiles failed"));	//beware, the last argument may not be used in sm_value_create, because
 
@@ -1346,5 +1161,5 @@
 
 quit:
-	free_transport((rsync_transport_t)&transport);
+	free_transport(&transport);
 	sm_value_free(&req);
 	return SM_DEBUG_LEAVE_INT(result);
@@ -1370,9 +1185,9 @@
 	}
 
-	fun_result = GetSignature((rsync_transport_t)&transport, req[0]->vstring, req[1]->vstring, &sig);
+	fun_result = GetSignature(&transport, req[0]->vstring, req[1]->vstring, &sig);
 	SM_TRY_NOT(response = sm_value_create(1, SM_VALUE_RET_CODE, fun_result, "Error in GetSignature"));
 
 	if (fun_result == RSyncNoError)
-		SM_TRY_NOT(signature_to_icomm((rsync_transport_t)&transport, &sig, &response));
+		SM_TRY_NOT(signature_to_icomm(&transport, &sig, &response));
 
 quit:
@@ -1386,5 +1201,5 @@
 		result = SM_OK;
 
-	free_transport((rsync_transport_t)&transport);
+	free_transport(&transport);
 	sm_value_free(&req);
 
@@ -1415,10 +1230,10 @@
 	}
 
-	if(!icomm_to_signature((rsync_transport_t)&transport, req + 2, &sig)) {
+	if(!icomm_to_signature(&transport, req + 2, &sig)) {
 		sm_error("Invalid request, can't create signature");
 		goto fault;
 	}
 
-	fun_result = GetDeltaBegin((rsync_transport_t)&transport, req[0]->vstring, req[1]->vstring, &sig, &context);
+	fun_result = GetDeltaBegin(&transport, req[0]->vstring, req[1]->vstring, &sig, &context);
 	sm_value_free(&req);
 
@@ -1495,5 +1310,5 @@
 	result = SM_OK;
 quit:
-	free_transport((rsync_transport_t)&transport);
+	free_transport(&transport);
 	return SM_DEBUG_LEAVE_INT(result);
 fault:
@@ -1520,5 +1335,5 @@
 	}
 
-	fun_result = PutDeltaBegin((rsync_transport_t)&transport, req[0]->vstring, req[1]->vstring, &context);
+	fun_result = PutDeltaBegin(&transport, req[0]->vstring, req[1]->vstring, &context);
 
 	SM_TRY_NOT(response = sm_value_create(1, SM_VALUE_RET_CODE, fun_result, "PutDeltaBegin failed"));
@@ -1587,5 +1402,5 @@
 
 quit:
-	free_transport((rsync_transport_t)&transport);
+	free_transport(&transport);
 	return SM_DEBUG_LEAVE_INT(result);
 
@@ -1749,5 +1564,5 @@
 	sm_info("Stat on file: %s", path);
 
-	if (lstat(path, &buf) != 0) {
+	if (stat(path, &buf) != 0) {
 		char errmsg[256] = "";
 		int saved_errno = errno;
@@ -2024,5 +1839,4 @@
 	const char *submitted_jsdl = NULL;
 	const char *jsdl = NULL;
-        const char *project = NULL;
 	sm_ret_code_t ret;
 	sm_value_t *response = NULL;
@@ -2051,8 +1865,4 @@
 	job->set_submitted_jsdl(job, submitted_jsdl);
 	job->set_jsdl(job, jsdl);
-        
-        project = smc_jsdl_get_project(job->get_submitted_jsdl_parsed(job));
-        if (project)
-            job->set_project(job, project);
 
 	if (atc_token)
@@ -2086,5 +1896,4 @@
 		SM_TRY_NOT(subresult = sm_value_create(3, SM_VALUE_RET_CODE, SUBMISSION_OK, SM_VALUE_NONE, SM_VALUE_STRING, id));
 
-		sm_info("Created activity (stage-in): id = %s ", id);
 	} else if (smc_jsdl_has_application(job->get_jsdl_parsed(job))) {
 		/* We use job->get_jsdl(job) and not jsdl to have WorkingDirectory
@@ -2100,11 +1909,8 @@
 			drms_id = sm_strdup(subresult[1]->vstring);
 
-		sm_info("Created activity: id = %s drms_id = %s", id, drms_id);
-
 	} else if (smc_jsdl_stage_out_requested(job->get_jsdl_parsed(job))) {
 		sm_debug("Activity has no application defined. No need to stage in, proceeding directly to stage out.");
 		SM_TRY_NOT_OK(smc_staging_start_stage_out(job, module_manager));
 		SM_TRY_NOT(subresult = sm_value_create(3, SM_VALUE_RET_CODE, SUBMISSION_OK, SM_VALUE_NONE, SM_VALUE_STRING, id));
-		sm_info("Created activity (stage-out): id = %s ", id);
 	} else {
 		sm_debug("Empty Activity, finishing.");
@@ -2112,5 +1918,4 @@
 		SAVE_JOB();
 		SM_TRY_NOT(subresult = sm_value_create(3, SM_VALUE_RET_CODE, SUBMISSION_OK, SM_VALUE_NONE, SM_VALUE_STRING, id));
-		sm_info("Created empty activity: id = %s ", id);
 	}
 
@@ -2158,5 +1963,5 @@
 	sm_value_t *params = NULL;
 	sm_value_t *subresult = NULL;
-	const char *drms_id;
+	sm_list_t extra_info_list = NULL;
 
 	SM_DEBUG_ENTER();
@@ -2166,22 +1971,4 @@
 		goto fault;
 	}
-
-	assert(sm_value_count(params) == 1);
-	assert(SM_VALUE_IS_STRING(params[0]));
-
-	sm_mutex_lock(&jobs_map_lock);
-	drms_id = params[0]->vstring;
-	if (xmlHashLookup(submitted_jobs, (xmlChar *)drms_id) == NULL && xmlHashLookup(orphaned_jobs, (xmlChar *)drms_id) == NULL) {
-		int *state;
-		sm_notice("Job %s is not known to the session process. Adding to orphaned list (count=%d)", drms_id, xmlHashSize(orphaned_jobs));
-		state = sm_malloc(sizeof(*state));
-
-		if (!state || xmlHashAddEntry(orphaned_jobs, (xmlChar *) drms_id, state) != 0) {
-			sm_error("Could not add %s to the orphaned jobs list", drms_id);
-		} else {
-			sm_cond_broadcast(&jobs_map_cond);
-		}
-	}
-	sm_mutex_unlock(&jobs_map_lock);
 
 	if (!submission_module) {
@@ -2195,4 +1982,11 @@
 	}
 
+	/* XXX: multiple identifiers */
+	sm_signal_emit("smc_job_info", local_resource_manager_type[2]->vstring, params[0]->vstring, &extra_info_list);
+	SM_ASSERT((!extra_info_list || sm_list_count(extra_info_list) == 1), "at most one module can be connected to the smc_job_info signal");
+	if (extra_info_list) {
+		sm_value_append(&subresult, 1, SM_VALUE_ARRAY, (sm_value_t *)extra_info_list->data);
+	}
+
 	if (smc_icomm_respond_GetActivityStatuses(fd, subresult) != SM_OK) {
 		sm_error("Failed to send GetActivityStatuses response");
@@ -2200,5 +1994,4 @@
 	}
 
-	sm_value_free(&params);
 	/* sm_signal_emit already freed params: sm_value_free(&params); */
 	return SM_OK;
@@ -2251,11 +2044,9 @@
 		 * set and saved in database so there's a possibility of a race
 		 * condition if someone decides to submit the same job immediately. */
-
-
 		for (i = 0; i < jobs_count; i++) {
 			smc_job_t job = jobs[i];
 			if (job && SM_RET_CODE_OK(subresult[i]->vretcode)) {
 				smc_staging_delete_on_termination(job, true);
-				job->set_cancelled(job, SM_TRUE); /* this will not cause the job record to be moved to accounting table. We must wait until drmaa_wait finishes. */
+				job->set_state(job, SMC_CANCELLED);
 				SAVE_JOB();
 			}
@@ -2292,5 +2083,5 @@
 
 static void
-jobs_deallocator(void *payload, xmlChar *name sm_unused)
+submitted_jobs_deallocator(void *payload, xmlChar *name sm_unused)
 {
 	SM_FREE(payload);
@@ -2302,5 +2093,6 @@
 	smc_job_state_t *state;
 
-	if (!(state = sm_malloc(sizeof(*state))))
+	state = sm_malloc(sizeof(*state));
+	if (!state)
 		return NULL;
 
@@ -2316,6 +2108,4 @@
 
 	SM_DEBUG_ENTER();
-
-	sm_debug("local_resource_manager_type = %d", local_resource_manager_type[1]->vint32);
 
 	/* Sun Grid Engine */
@@ -2334,18 +2124,29 @@
 				else if (!strcmp(name, "mem"))
 					job->set_mem_usage(job, atof(value));
-			}
-		}
-	} else if (local_resource_manager_type[1]->vint32 == SUBMISSION_DRMS_TORQUE || local_resource_manager_type[1]->vint32 == SUBMISSION_DRMS_PBSPRO ) {
-			sm_debug("parsing Torque/PBS Pro rusage");
+				else if (!strcmp(name, "start_time")) {
+					time_t timet = atof(value);
+					struct tm timetm;
+
+					localtime_r(&timet, &timetm);
+					job->set_start_time(job, timetm);
+				}
+
+				/* We don't use submission_time and end_time as
+				 * these values should include staging and thus
+				 * are set by job module. */
+			}
+		}
+	} else if (local_resource_manager_type[1]->vint32 == SUBMISSION_DRMS_TORQUE) {
+			sm_info("parsing torque rusage");
 
 			for (i = 0; i < sm_value_count(array); i++) {
 				int slen = strlen(array[i]->vstring) + 1;
 				char name[32] = "";
-				char *value = NULL;
+				char *value = sm_malloc(slen * sizeof(char));
 
 				SM_ASSERT(SM_VALUE_IS_STRING(array[i]), "rusage array contains non-string element");
 
-				if ((value = sm_malloc(slen * sizeof(char))) && sscanf(array[i]->vstring, "%31[^=]=%s", name, value) == 2) { /* sizeof(value) > strlen(array[i]->vstring) so sscanf is safe here */
-					sm_debug("rusage: %s=%s", name, value);
+				if (value && sscanf(array[i]->vstring, "%31[^=]=%s", name, value) == 2) {
+					sm_info("rusage: %s=%s", name, value);
 
 					if (!strcmp(name, "cpu"))
@@ -2363,5 +2164,20 @@
 					else if (!strcmp(name, "project"))
 						job->set_project(job, value);
+					else if (!strcmp(name, "start_time")) {
+						time_t timet = atof(value);
+						struct tm timetm;
+
+						localtime_r(&timet, &timetm);
+						job->set_start_time(job, timetm);
 					}
+
+
+					/* We don't use submission_time and end_time as
+					 * these values should include staging and thus
+					 * are set by job module. */
+				} else {
+					sm_error("failed to parse rusage: %s", array[i]->vstring);
+				}
+
 				sm_free(value);
 			}
@@ -2369,29 +2185,4 @@
 
 	sm_value_free(&result);
-}
-
-static void
-orphaned_wait_scanner(void *payload sm_unused, void *data, xmlChar *name)
-{
-	sm_value_t *result = *(sm_value_t **)data;
-	sm_value_t *job_id = NULL;
-
-	if (result) {
-		sm_debug("orphaned_wait_scanner: Skipping job %s. Already waited one.", name);
-		return;
-	}
-
-	job_id = sm_value_create(1, SM_VALUE_STRING, name);
-	result = submission_module->wait_single((sm_module_t) submission_module, job_id);
-	sm_value_free(&job_id);
-
-	if (result && SM_VALUE_RET_CODE_OK(result[0])) {
-		sm_info("Successfully waited for job: %s", name);
-	} else if (result) {
-		sm_debug("Wait returned error %d:%s", SM_VALUE_RET_CODE_C(result[0]), SM_VALUE_RET_CODE_STRING(result[0]));
-		sm_value_free(&result);
-	}
-
-	*((sm_value_t **)data) = result;
 }
 
@@ -2400,10 +2191,8 @@
 {
 	sm_value_t *result = NULL;
-	SM_BOOL empty_run = SM_TRUE; /*this variable denotes than in the last loop we did not rip any job */
 
 	assert(submission_module);
 
 	SM_DEBUG_ENTER();
-	
 
 	for (;;) {
@@ -2412,99 +2201,26 @@
 		sm_ret_code_t ret;
 
-		sm_mutex_lock(&jobs_map_lock);
-
-		while (submitted_jobs && xmlHashSize(submitted_jobs) == 0
-			&& orphaned_jobs && xmlHashSize(orphaned_jobs) == 0
-			&& !session_process_exiting) {
-			sm_debug("No submitted/orphaned jobs, no exiting flag set, submission waiting thread is idle");
-			sm_cond_wait(&jobs_map_cond, &jobs_map_lock);
-		}
-
-		sm_mutex_unlock(&jobs_map_lock);
-
-		if (session_process_exiting) {
-			sm_debug("Exiting submission_waiting_thread_loop");
+		sm_mutex_lock(&submitted_jobs_lock);
+
+		while (submitted_jobs && xmlHashSize(submitted_jobs) == 0) {
+			sm_debug("No submitted jobs, submission waiting thread is idle");
+			sm_cond_wait(&submitted_jobs_cond, &submitted_jobs_lock);
+		}
+
+		sm_mutex_unlock(&submitted_jobs_lock);
+
+		if (!submitted_jobs) {
 			sm_value_free(&result);
 			break;
 		}
 
-		/* wait all, wait/ps on all orphaned */
-		sm_mutex_lock(&jobs_map_lock);
-		while (!session_process_exiting) {
-			sm_mutex_unlock(&jobs_map_lock);
-
-			sm_debug("Submitted jobs: %d, empty_run: %d", xmlHashSize(submitted_jobs), empty_run);
-
-			if (xmlHashSize(submitted_jobs) > 0 && empty_run) {
-
-				result = submission_module->wait((sm_module_t) submission_module); /* blocking call (with timeout)*/
-
-				if (result && SM_VALUE_RET_CODE_C(result[0]) == SUBMISSION_WAIT_TIMEOUT_FAULT) {
-					sm_value_free(&result); /* timeout, check orphaned before retrying*/
-				} else {
-					break; /* process wait returned error code */
-				}
-
-			} else if (empty_run) {
-				sleep(orphaned_jobs_polling_period); /* this prevents active waiting */
-			}
-			
-
-			if (time(NULL) - session_process_start_time > (int)(session_process_maxlifetime * 3600)) { 
-				sm_notice("Session process lifetime exceeded: %.3fh > %dh", ((double)(time(NULL) - session_process_start_time)) / 3600, session_process_maxlifetime);
-
-				sm_mutex_lock(&jobs_map_lock);
-				session_process_exiting = SM_TRUE;
-				sm_cond_broadcast(&jobs_map_cond);
-				sm_mutex_unlock(&jobs_map_lock);
-				break;
-			}
-
-			/* scan wait on all orphaned TODO: nonblocking*/
-			sm_mutex_lock(&jobs_map_lock); /* this also do a cache flush of session_process_exiting */
-			xmlHashScan(orphaned_jobs, orphaned_wait_scanner, &result);
-			sm_mutex_unlock(&jobs_map_lock);
-			if (result) {
-				sm_info("Orphaned jobs scanner waited a job.");
-				break;
-			} else  {
-				empty_run = SM_TRUE;
-			}
-		}
-
-		if (session_process_exiting)
-			break;
-
-		if (!result) {
-			sm_debug("Timeout");
+		result = submission_module->wait((sm_module_t) submission_module);
+
+		if (!result || SM_VALUE_RET_CODE_C(result[0])) {
+			sm_error("Submission module failed to wait (%s). Retrying in 5 seconds...", SM_VALUE_RET_CODE_STRING(result[0]));
+			sm_value_free(&result);
+			sleep(5);
 			continue;
 		}
-
-		if (result && SM_VALUE_RET_CODE_C(result[0])) {
-			sm_error("Submission module failed to wait (%s). Retrying in 15 seconds...", (result ? SM_VALUE_RET_CODE_STRING(result[0]) : ""));
-			sm_value_free(&result);
-
-			sm_mutex_lock(&jobs_map_lock);
-			if (last_drms_failure_time == 0) {
-				last_drms_failure_time = time(NULL);
-			} else if (time(NULL) - last_drms_failure_time > (int)session_process_maxlifetime_with_drms_errors ) {
-				/* we can not stand more */
-				sm_error("Observed DRMS errors in waiting loop for %d seconds. Exiting session process...", (int)(time(NULL) - last_drms_failure_time));
-				session_process_exiting = SM_TRUE;
-				sm_cond_broadcast(&jobs_map_cond);
-				sm_mutex_unlock(&jobs_map_lock);
-				break;
-			}
-			sm_mutex_unlock(&jobs_map_lock);
-
-			sleep(15);
-			continue;
-		} else if (last_drms_failure_time) { /*this variable is volatile*/
-			sm_mutex_lock(&jobs_map_lock);
-			last_drms_failure_time = 0;
-			sm_mutex_unlock(&jobs_map_lock);
-		}
-
-		empty_run = SM_FALSE;
 
 		assert(SM_VALUE_IS_STRING(result[2]));
@@ -2523,5 +2239,4 @@
 					/* This job was cancelled because we found it in the
 					 * accounting table. There's nothing we can do now. */
-					sm_info("Job %s was either cancelled or ripped by some other process", jobid);
 				}
 			}
@@ -2535,8 +2250,4 @@
 				job->set_posix_signal_name(job, result[4]->vstring);
 
-			if (!SM_VALUE_IS_NONE(result[5]))
-				parse_rusage(result[5]->varray, job);
-
-
 			job->set_state(job, SMC_FAILED);
 			smc_staging_delete_on_termination(job, true);
@@ -2545,7 +2256,6 @@
 
 			job->set_exit_status(job, result[3]->vint32);
-
-			if (!SM_VALUE_IS_NONE(result[5]))
-				parse_rusage(result[5]->varray, job);
+			if (!SM_VALUE_IS_NONE(result[4]))
+				parse_rusage(result[4]->varray, job);
 
 			if (smc_jsdl_stage_out_requested(job->get_jsdl_parsed(job))) {
@@ -2563,10 +2273,8 @@
 fault:
 dispose:
-		sm_mutex_lock(&jobs_map_lock);
-		xmlHashRemoveEntry(submitted_jobs, (xmlChar *) jobid, jobs_deallocator);
-		xmlHashRemoveEntry(orphaned_jobs, (xmlChar *) jobid, jobs_deallocator);
-		xmlHashRemoveEntry(missing_jobs, (xmlChar *) jobid, jobs_deallocator);
-		sm_cond_broadcast(&jobs_map_cond);
-		sm_mutex_unlock(&jobs_map_lock);
+		sm_mutex_lock(&submitted_jobs_lock);
+		xmlHashRemoveEntry(submitted_jobs, (xmlChar *) jobid, submitted_jobs_deallocator);
+		sm_cond_broadcast(&submitted_jobs_cond);
+		sm_mutex_unlock(&submitted_jobs_lock);
 
 		smc_job_free(&job);
@@ -2582,12 +2290,9 @@
 {
 	smc_job_state_t *state = payload;
-	smc_job_state_t *original_state1 = NULL;
-	smc_job_state_t *original_state2 = NULL;
+	smc_job_state_t *original_state;
 	sm_value_t *params = NULL;
 	sm_value_t *result = NULL;
 	smc_job_t job = NULL;
 	sm_ret_code_t ret;
-	SM_BOOL state_changed = SM_FALSE;
-
 
 	/*
@@ -2606,4 +2311,10 @@
 	SM_DEBUG_ENTER_STR(name);
 
+	ret = smc_job_get_by_drms_id((const char *) name, &job);
+	if (ret.code)
+		goto fault;
+
+	if (job->get_state(job) == SMC_CANCELLED)
+		goto out;
 
 	SM_TRY_NOT(params = sm_value_create(1, SM_VALUE_STRING, name));
@@ -2612,76 +2323,17 @@
 	if (SM_VALUE_RET_CODE_OK(result[0])) {
 
+		job->set_state(job, result[1]->vint32);
+
+		/* This shouldn't hurt if there's actually no state change. */
+		ret = job->save(job);
+		if (ret.code)
+			sm_error("Failed to update job %s in database (%d:%s)", job->get_drms_id(job), ret.code, ret.string);
+
 		/* We are working on a copy of submitted_jobs, so we need to
 		 * update state in the original hash table. */
-		sm_mutex_lock(&jobs_map_lock);
-
-		last_drms_failure_time = 0;
-
-		if ((original_state1 = xmlHashLookup(submitted_jobs, name)) && *original_state1 != ((unsigned int)result[1]->vint32)) {
-			sm_info("Polling scanner. State of submitted job %s has changed %s -> %s", name, smc_job_state_str(*original_state1), smc_job_state_str(result[1]->vint32));
-			*original_state1 = result[1]->vint32;
-			state_changed = SM_TRUE;
-		} else if ((original_state2 = xmlHashLookup(orphaned_jobs, name)) && *original_state2 != ((unsigned int)result[1]->vint32)) {
-			sm_info("Polling scanner. State of orphaned job %s has changed %s -> %s", name, smc_job_state_str(*original_state2), smc_job_state_str(result[1]->vint32));
-			*original_state2 = result[1]->vint32;
-			state_changed = SM_TRUE;
-		} else if (original_state1 == NULL && original_state2 == NULL) {
-			sm_info("Polling Scanner. Could not found %s either in submitted and orphaned jobs list. Job might be already waited", name); 
-		}
-		sm_mutex_unlock(&jobs_map_lock);
-
-		if (state_changed) {
-			ret = smc_job_get_by_drms_id((const char *) name, &job);
-			if (ret.code)
-				goto fault;
-
-			if (job->get_state(job) == SMC_CANCELLED)
-				goto out; /* TODO - still needed ? */ 
-
-			job->set_state(job, result[1]->vint32);
-
-			/* This shouldn't hurt if there's actually no state change. */
-			ret = job->save(job);
-			if (ret.code)
-				sm_error("Failed to update job %s in database (%d:%s)", job->get_drms_id(job), ret.code, ret.string);
-
-		}
-	} else if (SM_VALUE_RET_CODE_C(result[0]) == SUBMISSION_UNKNOWN_ACTIVITY_IDENTIFIER_FAULT) {
-		time_t *missing_time = NULL;
-		sm_debug("Job %s is not known to the LRMS.", name); /* In many cases this does not have to be an error - e.g. job was not ripped yet. But... */
-		sm_mutex_lock(&jobs_map_lock);
-		missing_time = xmlHashLookup(missing_jobs, name);
-		sm_mutex_unlock(&jobs_map_lock);
-
-		if (missing_time) {
-			if ((time(NULL) - *missing_time) > (int)max_job_missing_time) {
-				sm_error("Job %s missing for more than %d seconds.", name, (int)(time(NULL) - *missing_time));
-				//TODO job->on_missing(job);
-				sm_mutex_lock(&jobs_map_lock);
-				xmlHashRemoveEntry(submitted_jobs, name, jobs_deallocator);
-				xmlHashRemoveEntry(orphaned_jobs, name, jobs_deallocator);
-				xmlHashRemoveEntry(missing_jobs, name, jobs_deallocator);
-				sm_mutex_unlock(&jobs_map_lock);
-			}
-		} else {
-			if ((missing_time = sm_malloc(sizeof(*missing_time)))) {
-				*missing_time = time(NULL);
-				sm_mutex_lock(&jobs_map_lock);
-				xmlHashAddEntry(missing_jobs, (xmlChar *) name, missing_time);
-				sm_mutex_unlock(&jobs_map_lock);
-			}
-		}
-	} else {
-		sm_notice("Failed to poll for status of the job %s: %s.", name, SM_VALUE_RET_CODE_STRING(result[0]));
-
-		sm_mutex_lock(&jobs_map_lock);
-		if (!last_drms_failure_time) {
-			last_drms_failure_time = time(NULL);
-		} else if (time(NULL) - last_drms_failure_time > (int)session_process_maxlifetime_with_drms_errors ) {
-			sm_error("Observed DRMS errors in polling_scaner for %d seconds. Exiting session process...", (int)(time(NULL) - last_drms_failure_time));
-			session_process_exiting = SM_TRUE;
-			sm_cond_broadcast(&jobs_map_cond);
-		}
-		sm_mutex_unlock(&jobs_map_lock);
+		sm_mutex_lock(&submitted_jobs_lock);
+		if ((original_state = xmlHashLookup(submitted_jobs, name)))
+			*original_state = result[1]->vint32;
+		sm_mutex_unlock(&submitted_jobs_lock);
 	}
 
@@ -2698,6 +2350,4 @@
 	unsigned int i;
 	xmlHashTablePtr submitted_jobs_polling_copy = NULL;
-	xmlHashTablePtr orphaned_jobs_polling_copy = NULL;
-
 
 	assert(submission_module);
@@ -2706,16 +2356,13 @@
 
 	for (;;) {
-		sm_mutex_lock(&jobs_map_lock);
-
-		while (submitted_jobs && xmlHashSize(submitted_jobs) == 0
-		    && orphaned_jobs && xmlHashSize(orphaned_jobs) == 0 
-		    && !session_process_exiting) {
-			sm_debug("No submitted/orphaned jobs, no exiting flag set, submission polling thread is idle");
-			sm_cond_wait(&jobs_map_cond, &jobs_map_lock);
-		}
-
-		if (session_process_exiting) {
-			sm_mutex_unlock(&jobs_map_lock);
-			sm_debug("Exiting submission_polling_thread_loop");
+		sm_mutex_lock(&submitted_jobs_lock);
+
+		while (submitted_jobs && xmlHashSize(submitted_jobs) == 0) {
+			sm_debug("No submitted jobs, submission polling thread is idle");
+			sm_cond_wait(&submitted_jobs_cond, &submitted_jobs_lock);
+		}
+
+		if (!submitted_jobs) {
+			sm_mutex_unlock(&submitted_jobs_lock);
 			break;
 		}
@@ -2724,26 +2371,19 @@
 		 * submission during a polling phase. */
 		submitted_jobs_polling_copy = xmlHashCopy(submitted_jobs, submitted_jobs_copier);
-		orphaned_jobs_polling_copy = xmlHashCopy(orphaned_jobs, submitted_jobs_copier);
-
-		sm_mutex_unlock(&jobs_map_lock);
+		sm_mutex_unlock(&submitted_jobs_lock);
 
 		if (submitted_jobs_polling_copy) {
 			xmlHashScan(submitted_jobs_polling_copy, polling_scanner, NULL);
-			xmlHashFree(submitted_jobs_polling_copy, jobs_deallocator);
-		}
-
-		if (orphaned_jobs_polling_copy) {
-			xmlHashScan(orphaned_jobs_polling_copy, polling_scanner, NULL);
-			xmlHashFree(orphaned_jobs_polling_copy, jobs_deallocator);
+			xmlHashFree(submitted_jobs_polling_copy, submitted_jobs_deallocator);
 		}
 
 		for (i = 0; i < job_status_polling_period; i++) {
-			SM_BOOL done;
+			bool done;
 
 			sleep(1);
 
-			sm_mutex_lock(&jobs_map_lock);
-			done = session_process_exiting;
-			sm_mutex_unlock(&jobs_map_lock);
+			sm_mutex_lock(&submitted_jobs_lock);
+			done = !submitted_jobs;
+			sm_mutex_unlock(&submitted_jobs_lock);
 
 			if (done)
@@ -2762,7 +2402,6 @@
 	sm_module_mode_t mode;
 	sm_status_ret_code_t status;
-	char *cwd_dir = NULL;
-	const char *home_dir = NULL;
 	struct passwd *pwd;
+	int ret;
 
 	SM_MANDATORY_P(data);
@@ -2776,14 +2415,30 @@
 	}
 
-	sm_log_set_log_ctxt(pwd->pw_name);
-
 	/* Fail-safe */
-	(void)chdir("/tmp");
-
+	ret = chdir("/tmp");
+
+	if (!pwd->pw_dir) {
+		char buf[256];
+		snprintf(buf, sizeof(buf), "User (%s) doesn't have a home directory?", pwd->pw_name);
+		sm_error("%s", buf);
+		goto fault;
+	}
+
+	if (chdir(pwd->pw_dir)) {
+		char buf[256];
+		sm_perror("chdir");
+		snprintf(buf, sizeof(buf), "Failed to change directory to user's (%s) home directory: %s", pwd->pw_name, pwd->pw_dir);
+		sm_notice("%s", buf);
+	}
+
+	if (sm_setenv("HOME", pwd->pw_dir) || sm_setenv("PWD", pwd->pw_dir) || sm_setenv("USER", pwd->pw_name)) {
+		sm_error("sm_setenv failed");
+		goto fault;
+	}
 
 	sm_mutex_init(&staging_in_progress_lock);
 
-	sm_mutex_init(&jobs_map_lock);
-	sm_cond_init(&jobs_map_cond);
+	sm_mutex_init(&submitted_jobs_lock);
+	sm_cond_init(&submitted_jobs_cond);
 
 	conf = sm_conf_setup_from_memory(data[0]->vstring, data[1]->vstring);
@@ -2819,5 +2474,4 @@
 	status |= sm_conf_node_uint(conf, SM_FALSE, "/conf:JobStatusPollingPeriod", &job_status_polling_period);
 	status |= sm_conf_node_bool(conf, SM_FALSE, "/conf:JobStatusFullPolling", &job_status_full_polling);
-	status |= sm_conf_node_bool(conf, SM_FALSE, "/conf:UseScratch", &use_scratch);
 	status |= sm_conf_node_uint(conf, SM_FALSE, "/conf:SubmittedJobsHashTable", &submitted_jobs_hash_table);
 
@@ -2829,11 +2483,4 @@
 	if (submitted_jobs_hash_table < 1024)
 		submitted_jobs_hash_table = 1024;
-	
-	if (use_scratch && !getenv("QCG_SCRATCH_DIR_ROOT")) {
-		sm_error("UseScratch set to true but QCG_SCRATCH_DIR_ROOT not defined. Falling back to HOME filesystem.");
-		use_scratch = SM_FALSE;
-	} else if (use_scratch) {
-		sm_debug("Using scratch file system: %s", getenv("QCG_SCRATCH_DIR_ROOT"));
-	}
 
 	sm_debug("session_process_timeout = %u", session_process_timeout);
@@ -2842,60 +2489,6 @@
 	sm_debug("submitted_jobs_hash_table = %u", submitted_jobs_hash_table);
 
-	if (!pwd->pw_dir && !use_scratch) {
-		char buf[256];
-		snprintf(buf, sizeof(buf), "User (%s) doesn't have a home directory and no UseScratch option given.", pwd->pw_name);
-		sm_error("%s", buf);
-		goto fault;
-	} 
-
-	if (use_scratch) {
-		cwd_dir = sm_asprintf("%s/%s", getenv("QCG_SCRATCH_DIR_ROOT"), pwd->pw_name);
-	} else {
-		cwd_dir = sm_strdup(pwd->pw_dir);
-	}
-	
-	if (use_scratch && access(cwd_dir, W_OK | X_OK) != 0) {
-		if (pwd->pw_dir) {
-			sm_debug("Unable to access user scratch directory %s falling back to home dir: %s", cwd_dir, pwd->pw_dir);
-			sm_free(cwd_dir);
-			cwd_dir = sm_strdup(pwd->pw_dir);
-		} else {
-			sm_error("User scratch directory not accessible and no home directory found");
-			goto fault;
-		}
-	}
-	
-	sm_info("Using CWD: %s (user=%s)", cwd_dir, pwd->pw_name);
-
-	if (use_scratch && !pwd->pw_dir) {
-		home_dir = cwd_dir; /*fallback*/
-	} else {
-		home_dir = pwd->pw_dir;
-	}
-
-	if (chdir(cwd_dir)) {
-		char buf[256];
-		sm_perror("chdir");
-		snprintf(buf, sizeof(buf), "Failed to change directory to user's (%s) %s directory: %s", pwd->pw_name, (use_scratch ? "SCRATCH": "HOME"), cwd_dir);
-		sm_debug("%s", buf);
-	}
-
-	if (sm_setenv("HOME", home_dir) || sm_setenv("PWD", cwd_dir) || sm_setenv("USER", pwd->pw_name)) {
-		sm_error("sm_setenv failed");
-		goto fault;
-	}
-
 	if (!(submitted_jobs = xmlHashCreate(submitted_jobs_hash_table))) {
 		sm_error("Failed to create submitted jobs hash table. Too big?");
-		goto fault;
-	}
-
-	if (!(orphaned_jobs = xmlHashCreate(submitted_jobs_hash_table))) {
-		sm_error("Failed to create orphaned jobs hash table. Too big?");
-		goto fault;
-	}
-
-	if (!(missing_jobs = xmlHashCreate(submitted_jobs_hash_table))) {
-		sm_error("Failed to create missing jobs hash table. Too big?");
 		goto fault;
 	}
@@ -2950,24 +2543,14 @@
 		int drms_type = local_resource_manager_type[1]->vint32;
 		char *drms_namespace = local_resource_manager_type[2]->vstring;
-		sm_info("Setting up: DRMS: %s (%d)" , drms_namespace, drms_type);
-	}
-
-	/* Setup BES FactoryAttributes xsd:any type handler */
-	if (sm_signal_register("smc_factory_attributes", 0, (sm_value_type_t []) { SM_VALUE_STRING }, 1, (sm_value_type_t []) { SM_VALUE_STRING }, 1) !=  SM_OK)
-		goto fault;
-
-	/* Setup BES FactoryAttributes ContainedResources type handler */
-	if (sm_signal_register("smc_contained_resources", 0, (sm_value_type_t []) { SM_VALUE_STRING }, 1, (sm_value_type_t []) { SM_VALUE_STRING }, 1) !=  SM_OK)
-		goto fault;
-
-	/* Setup job stats (estimated start time/memory usage handler */
-	if (sm_signal_register("smc_jobs_info", 0, (sm_value_type_t []) { SM_VALUE_STRING, SM_VALUE_ARRAY, SM_VALUE_BOOL }, 3, (sm_value_type_t []) { SM_VALUE_ARRAY }, 1) !=  SM_OK)
-		goto fault;
-
-	SM_FREE(cwd_dir);
+		sm_info("drms type = %d (ns=%s)" , drms_type, drms_namespace);
+	}
+
+	/* Setup job info handler (monitoring DRMS) */
+	if (sm_signal_register("smc_job_info", 0, (sm_value_type_t []) { SM_VALUE_STRING, SM_VALUE_STRING}, 2, (sm_value_type_t []) { SM_VALUE_STRING }, 1) !=  SM_OK)
+		goto fault;
+
 	return SM_OK;
 
 fault:
-	SM_FREE(cwd_dir);
 	sm_module_manager_free(&module_manager);
 	sm_conf_ctxt_free(&conf);
@@ -2978,36 +2561,24 @@
 session_process_cleanup(void)
 {
-	int submitted_count = -1, orphaned_count = -1;
+	int count;
 
 	SM_DEBUG_ENTER();
 
-	sm_mutex_lock(&jobs_map_lock);
-
-	while (((submitted_count = xmlHashSize(submitted_jobs)) > 0 || (orphaned_count = xmlHashSize(orphaned_jobs)) > 0) && !session_process_exiting) {
-		
-		if (submitted_count > 0)
-			sm_debug("Submission waiting thread still has %d jobs to wait for, waiting...", submitted_count);
-		else
-			sm_debug("Submission waiting thread still has %d + %d jobs to wait for, waiting...", submitted_count, orphaned_count);
-
-		sm_cond_wait(&jobs_map_cond, &jobs_map_lock);
+	sm_mutex_lock(&submitted_jobs_lock);
+
+	while ((count = xmlHashSize(submitted_jobs)) > 0) {
+		sm_debug("Submission waiting thread still has %d jobs to wait for, waiting...", count);
+		sm_cond_wait(&submitted_jobs_cond, &submitted_jobs_lock);
 	}
 
 	sm_debug("No jobs, cleaning up");
-	session_process_exiting = SM_TRUE;
-
-	xmlHashFree(submitted_jobs, jobs_deallocator);
+
+	xmlHashFree(submitted_jobs, NULL);
 	submitted_jobs = NULL;
 
-	xmlHashFree(orphaned_jobs, jobs_deallocator);
-	orphaned_jobs = NULL;
-
-	xmlHashFree(missing_jobs, jobs_deallocator);
-	missing_jobs = NULL;
-
 	sm_debug("Waking up the threads");
-	sm_cond_broadcast(&jobs_map_cond);
-
-	sm_mutex_unlock(&jobs_map_lock);
+	sm_cond_broadcast(&submitted_jobs_cond);
+
+	sm_mutex_unlock(&submitted_jobs_lock);
 
 	/* We need to wait for all the threads using our locks. */
@@ -3022,6 +2593,6 @@
 	}
 
-	sm_cond_destroy(&jobs_map_cond);
-	sm_mutex_destroy(&jobs_map_lock);
+	sm_cond_destroy(&submitted_jobs_cond);
+	sm_mutex_destroy(&submitted_jobs_lock);
 	sm_mutex_destroy(&staging_in_progress_lock);
 
@@ -3032,12 +2603,8 @@
 	sm_conf_ctxt_free(&conf);
 
+	sm_signal_unregister("smc_job_info");
+
 	sm_value_free(&local_resource_manager_type);
 
-	sm_signal_unregister("smc_factory_attributes");
-	sm_signal_unregister("smc_contained_resources");
-	sm_signal_unregister("smc_jobs_info");
-
-
-	sm_info("Exited session process after %d seconds", (int)(time(NULL) -  session_process_start_time));
 	SM_DEBUG_LEAVE_VOID();
 }
@@ -3080,11 +2647,4 @@
 			handle_PutDelta(fd);
 			break;
-		case smc_icomm_GetDRMS:
-			handle_GetDRMS(fd);
-			break;
-		case smc_icomm_GetDRMSInfos:
-			handle_GetDRMSInfos(fd);
-			break;
-	
 		default:
 			SM_ASSERT(0, "Unknown request (%d) in %s", request, __FUNCTION__);
@@ -3101,6 +2661,4 @@
 
 	sm_debug("Session process for uid = %u starting (one_shot = %d)", getuid(), one_shot);
-
-	session_process_start_time = time(NULL);
 
 	if (session_process_setup(data, one_shot) != SM_OK) {
@@ -3151,7 +2709,7 @@
 				continue;
 
-			sm_mutex_lock(&jobs_map_lock);
-			terminating = ((xmlHashSize(submitted_jobs) == 0) && (xmlHashSize(orphaned_jobs) == 0)) || session_process_exiting;
-			sm_mutex_unlock(&jobs_map_lock);
+			sm_mutex_lock(&submitted_jobs_lock);
+			terminating = (xmlHashSize(submitted_jobs) == 0);
+			sm_mutex_unlock(&submitted_jobs_lock);
 
 			if (terminating) {
Index: trunk/src/modules/qcg_comp_service/session_process.h
===================================================================
--- trunk/src/modules/qcg_comp_service/session_process.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/session_process.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_SESSION_PROCESS_H
Index: trunk/src/modules/qcg_comp_service/Makefile.am
===================================================================
--- trunk/src/modules/qcg_comp_service/Makefile.am	(revision 623)
+++ trunk/src/modules/qcg_comp_service/Makefile.am	(revision 1)
@@ -42,6 +42,5 @@
 	     schemas/jsdl.xsd \
 	     schemas/qcg-comp-rsync.wsdl \
-	     schemas/qcg-comp-socks.wsdl \
-             schemas/qcg-comp-monitoring.xsd
+	     schemas/qcg-comp-socks.wsdl
 	     
 
@@ -56,5 +55,4 @@
 			ardl.h \
 			bes_factory.c \
-			monitoring.c \
 			bes_management.c \
 			common.h \
Index: trunk/src/modules/qcg_comp_service/qcg_comp_socks.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_socks.c	(revision 338)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_socks.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -243,5 +236,5 @@
 		goto fault;
 
-	sm_debug("socks_policy = '%s'", socks_policy);
+	sm_info("socks_policy = '%s'", socks_policy);
 
 	if (!socks_policy || !strlen(socks_policy)) {
@@ -257,8 +250,9 @@
 
 	if (sm_conf_node_strdup(this->conf_ctxt, SM_FALSE, "/conf:SOCKSPolicy/@authentication", &str) != SM_OK) {
-		sm_info("No SOCKS authentication method defined. Using default.");
-		socks_config.authentication = smc_socks_atn_none;
-		/*goto fault;*/
-	} else if (strcmp(str,"perConnection") == 0) {
+		sm_error("No SOCKS authentication method defined.");
+		goto fault;
+	}
+
+	if (strcmp(str,"perConnection") == 0) {
 		socks_config.authentication = smc_socks_atn_per_connection;
 	} else if (strcmp(str, "perSession") == 0) {
@@ -290,5 +284,6 @@
 	sm_debug("allowed_src_hosts_count  = %d", socks_config.allowed_src_hosts_count);
 
-	SM_TRY_NOT(socks_config.allowed_ports = sm_calloc(socks_config.allowed_dest_ports_count, sizeof(*socks_config.allowed_ports)));
+
+	socks_config.allowed_ports = sm_calloc(socks_config.allowed_dest_ports_count, sizeof(*socks_config.allowed_ports));
 
 	for (i = 0; i < socks_config.allowed_dest_ports_count; i++) {
@@ -315,5 +310,5 @@
 	}
 
-	SM_TRY_NOT(socks_config.allowed_dst_hosts = sm_calloc(socks_config.allowed_dest_hosts_count, sizeof(*socks_config.allowed_dst_hosts)));
+	socks_config.allowed_dst_hosts = sm_calloc(socks_config.allowed_dest_hosts_count, sizeof(*socks_config.allowed_dst_hosts));
 
 	for (i = 0; i < socks_config.allowed_dest_hosts_count; i++) {
@@ -358,5 +353,5 @@
 	}
 
-	SM_TRY_NOT(socks_config.allowed_src_hosts = sm_calloc(socks_config.allowed_src_hosts_count, sizeof(*socks_config.allowed_src_hosts)));
+	socks_config.allowed_src_hosts = sm_calloc(socks_config.allowed_src_hosts_count, sizeof(*socks_config.allowed_src_hosts));
 
 	for (i = 0; i < socks_config.allowed_src_hosts_count; i++) {
Index: trunk/src/modules/qcg_comp_service/jsdl.c
===================================================================
--- trunk/src/modules/qcg_comp_service/jsdl.c	(revision 963)
+++ trunk/src/modules/qcg_comp_service/jsdl.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <stdbool.h>
@@ -133,25 +126,4 @@
 
 const char *
-smc_jsdl_get_project(_jsdl__JobDefinition *jsdl)
-{
-	SM_MANDATORY_P(jsdl);
-
-	SM_DEBUG_ENTER();
-
-	if (jsdl->jsdl__JobDescription->jsdl__JobIdentification) {
-            struct jsdl__JobIdentification_USCOREType *jobid = jsdl->jsdl__JobDescription->jsdl__JobIdentification;
-            
-            if (jobid) {
-                char **jsdl_project = jobid->jsdl__JobProject;
-
-                if (jsdl_project && jobid->__sizeJobProject > 0 && jsdl_project && jsdl_project[0])
-                    return SM_DEBUG_LEAVE_STR(jsdl_project[0]);
-            }
-	}
-
-	return SM_DEBUG_LEAVE_STR(NULL);
-}
-
-const char *
 smc_jsdl_get_working_dir(_jsdl__JobDefinition *jsdl, SM_BOOL create)
 {
Index: trunk/src/modules/qcg_comp_service/common.h
===================================================================
--- trunk/src/modules/qcg_comp_service/common.h	(revision 623)
+++ trunk/src/modules/qcg_comp_service/common.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_COMMON_H
@@ -36,8 +29,3 @@
 typedef char *(*smc_strdup_function)(void *ctxt, const char *str);
 
-void *smc_monitor_thread_loop(void *arg sm_unused);
-int smc_get_factory_attr(char *drms_type, char **contained_resource, sm_list_t *factory_attributes);
-void smc_get_job_stats(char *drms_type, SM_BOOL full_info);
-
-
 #endif /* __SMC_COMMON_H */
Index: trunk/src/modules/qcg_comp_service/qcg_comp_socks_serve.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_socks_serve.c	(revision 338)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_socks_serve.c	(revision 1)
@@ -1,24 +1,17 @@
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -245,5 +238,5 @@
 			if ( 1 ) {
 				context->status = Ok;
-				context->process = client_check;
+                                context->process = client_check;
 				context->len-=i+1;
 				memmove(context->buffer, context->buffer+i+1, context->len);
@@ -341,5 +334,5 @@
 			sm_notice("Client address rejected");
 			goto fail;
-		}
+                }
 	}
 	else {
@@ -348,5 +341,7 @@
 	}
 
-	if (!(result = sm_malloc(sizeof(*result))))
+	result = sm_malloc(sizeof(*result));
+
+	if(!result)
 		goto fail;
 
@@ -359,11 +354,13 @@
 
 	result->size = 100*1024;
-
-	if(!(result->buffer = sm_malloc(result->size)))
+	result->buffer = sm_malloc(result->size);
+
+	if(!result->buffer)
 		goto fail;
 
 	result->remote_size = 100*1024;
-
-	if(!(result->remote_buffer = sm_malloc(result->remote_size)))
+	result->remote_buffer = sm_malloc(result->remote_size);
+
+	if(!result->remote_buffer)
 		goto fail;
 
Index: trunk/src/modules/qcg_comp_service/faults.c
===================================================================
--- trunk/src/modules/qcg_comp_service/faults.c	(revision 394)
+++ trunk/src/modules/qcg_comp_service/faults.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <qcg-core/sm.h>
@@ -223,6 +216,6 @@
 				case SMC_STAGE_IN:
 					state->state = bes_factory__ActivityStateEnumeration__Pending;
-					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Stage_in;
-					if (!(state_union.qcf__Stage_in = super_transport->transport_malloc(super_transport, sizeof(struct _qcf__Stage_in))))
+					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Stage_in;
+					if (!(state_union.qcg_comp_factory__Stage_in = super_transport->transport_malloc(super_transport, sizeof(struct _qcg_comp_factory__Stage_in))))
 						goto fault;
 					state->union_ActivityStatusType = state_union;
@@ -230,6 +223,6 @@
 				case SMC_HELD:
 					state->state = bes_factory__ActivityStateEnumeration__Pending;
-					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Held;
-					if (!(state_union.qcf__Held = super_transport->transport_malloc(super_transport, sizeof(struct _qcf__Held))))
+					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Held;
+					if (!(state_union.qcg_comp_factory__Held = super_transport->transport_malloc(super_transport, sizeof(struct _qcg_comp_factory__Held))))
 						goto fault;
 					state->union_ActivityStatusType = state_union;
@@ -237,6 +230,6 @@
 				case SMC_QUEUED:
 					state->state = bes_factory__ActivityStateEnumeration__Pending;
-					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Queued;
-					if (!(state_union.qcf__Queued = super_transport->transport_malloc(super_transport, sizeof(struct _qcf__Queued))))
+					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Queued;
+					if (!(state_union.qcg_comp_factory__Queued = super_transport->transport_malloc(super_transport, sizeof(struct _qcg_comp_factory__Queued))))
 						goto fault;
 					state->union_ActivityStatusType = state_union;
@@ -244,6 +237,6 @@
 				case SMC_EXECUTING:
 					state->state = bes_factory__ActivityStateEnumeration__Running;
-					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Executing;
-					if (!(state_union.qcf__Executing = super_transport->transport_malloc(super_transport, sizeof(struct _qcf__Executing))))
+					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Executing;
+					if (!(state_union.qcg_comp_factory__Executing = super_transport->transport_malloc(super_transport, sizeof(struct _qcg_comp_factory__Executing))))
 						goto fault;
 					state->union_ActivityStatusType = state_union;
@@ -251,6 +244,6 @@
 				case SMC_SUSPENDED:
 					state->state = bes_factory__ActivityStateEnumeration__Running;
-					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Suspended;
-					if (!(state_union.qcf__Suspended = super_transport->transport_malloc(super_transport, sizeof(struct _qcf__Suspended))))
+					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Suspended;
+					if (!(state_union.qcg_comp_factory__Suspended = super_transport->transport_malloc(super_transport, sizeof(struct _qcg_comp_factory__Suspended))))
 						goto fault;
 					state->union_ActivityStatusType = state_union;
@@ -258,6 +251,6 @@
 				case SMC_STAGE_OUT:
 					state->state = bes_factory__ActivityStateEnumeration__Running;
-					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Stage_out;
-					if (!(state_union.qcf__Stage_out = super_transport->transport_malloc(super_transport, sizeof(struct _qcf__Stage_out))))
+					state->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Stage_out;
+					if (!(state_union.qcg_comp_factory__Stage_out = super_transport->transport_malloc(super_transport, sizeof(struct _qcg_comp_factory__Stage_out))))
 						goto fault;
 					state->union_ActivityStatusType = state_union;
@@ -306,5 +299,4 @@
 			assert(SM_VALUE_IS_STRING(data[0]));
 
-			SM_TRY_NOT(fault->application_fault.msg = super_transport->transport_strdup(super_transport, data[0]->vstring));
 			SM_TRY_NOT(d = super_transport->transport_malloc(super_transport, sizeof(*d)));
 			soap_default_bes_factory__InvalidRequestMessageFaultType(transport->soap, d);
Index: trunk/src/modules/qcg_comp_service/qcg_comp_socks.h
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_socks.h	(revision 153)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_socks.h	(revision 1)
@@ -2,19 +2,17 @@
 
 /*
- * QosCosGrid Notification
- * Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+ *  Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */
 
Index: trunk/src/modules/qcg_comp_service/bes_factory.c
===================================================================
--- trunk/src/modules/qcg_comp_service/bes_factory.c	(revision 1109)
+++ trunk/src/modules/qcg_comp_service/bes_factory.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -33,5 +26,4 @@
 #include <qcg-core/signal.h>
 #include <qcg-core/value.h>
-#include <qcg-core/thread.h>
 #include <qcg-core/xmalloc.h>
 #include <qcg-core/modules/modules.h>
@@ -52,4 +44,5 @@
 #include <include/jsdl_filter.h>
 #include <include/namespaces.h>
+#include <include/submission_module.h>
 
 
@@ -63,6 +56,4 @@
 
 extern struct Namespace qcgcomp_namespaces[];
-
-
 
 static sm_status_ret_code_t
@@ -149,15 +140,4 @@
 		THROW_INTERNAL_FAULT("JSDL size exceeds predefined limit");
 
-	/* !!!pkopta 2015-06-22
-	/* temporary - until full unicode support */
-	{
-		size_t len, i;
-
-		len = strlen(jsdl_str);
-		for (i = 0; i < len; ++i)
-			if ((unsigned char)jsdl_str[i] > 127)
-				THROW_INTERNAL_FAULT("Unicode not supported");
-	}
-
 	ret = smc_jsdl_handle_filters(jsdl_str, &jsdl_str_after_filters, (smc_strdup_function) soap_strdup, soap);
 
@@ -177,22 +157,5 @@
 
 	subject = transport->atc_token->get_last_oneline(transport->atc_token);
-
-	{
-		sm_atc_token_item_t proxy_ctxt = NULL;
-		sm_list_t ii = NULL;
-
-	        for (ii = transport->atc_token->items; ii; ii = ii->next) {
-        	        sm_atc_token_item_t item = ii->data;
-
-                	if (item->type == SM_ATC_TOKEN_X509_PROXY) {
-                        	proxy_ctxt = item;
-				break;
-                	}
-		}
-
-		if (proxy_ctxt != NULL) {
-			atc_token = transport->atc_token->serialize(transport->atc_token, proxy_ctxt);
-		}
-	}
+	atc_token = transport->atc_token->serialize(transport->atc_token, transport->atc_token->get_last(transport->atc_token));
 
 	if (atc_token) {
@@ -201,5 +164,5 @@
 				SM_VALUE_STRING, jsdl_str_after_filters, SM_VALUE_ARRAY,
 				atc_token));
-	} else { /* no proxy delegated*/
+	} else { /*anonymous*/
 		SM_TRY_NOT(params = sm_value_create(4, SM_VALUE_STRING, subject,
 				SM_VALUE_STRING, username, SM_VALUE_STRING, jsdl_str,
@@ -213,4 +176,5 @@
 		THROW_APP_FAULT_FROM_VAL(result);
 
+	sm_info("Created activity: id = %s", result[2]->vstring);
 
 	if (smc_create_activity_epr(transport, &bes_factory__CreateActivityResponse->ActivityIdentifier, result[2]->vstring) != SM_OK)
@@ -224,5 +188,4 @@
 
 fault:
-	sm_notice("Error while submitting JSDL: \n%s", SM_SAFE_STR(jsdl_str));
 	sm_alloc_tracked_free(&tracked);
 	SM_FREE(username);
@@ -233,5 +196,5 @@
 
 static sm_status_ret_code_t
-get_drms_state(smc_job_t job, smc_job_state_t *state)
+get_drms_state(smc_job_t job, smc_job_state_t *state, char **extra_info)
 {
 	uid_t uid;
@@ -271,4 +234,11 @@
 		assert(SM_VALUE_IS_INT(result[1]));
 		*state = result[1]->vint32;
+		if (sm_value_count(result) == 3 && extra_info) {
+			assert(SM_VALUE_IS_ARRAY(result[2]));
+			assert(SM_VALUE_IS_STRING(result[2]->varray[0]));
+			*extra_info = sm_strdup(result[2]->varray[0]->vstring);
+		} else if (extra_info) {
+			*extra_info = NULL;
+		}
 	}
 
@@ -301,7 +271,7 @@
 	smc_job_state_t state;
 	smc_job_state_t drms_state;
+	sm_ret_code_t ret;
 	sm_status_ret_code_t status;
 	char *extra_info = NULL;
-	extern SM_BOOL smc_only_owner_can_get_status;
 
 	SMC_FAULT_INIT;
@@ -317,24 +287,9 @@
 
 	SM_TRY_NOT_OK(get_job_from_epr(transport, fault, bes_factory__GetActivityStatuses->ActivityIdentifier, true, &jobs));
-
-	if (sm_list_count(jobs) > 1)
-		sm_error("Internal error: duplicated job record %s", job->get_id(job));
-
+	SM_ASSERT(sm_list_count(jobs) <= 1, "Parameter sweep not implemented in %s", __FUNCTION__);
 	job = jobs->data;
 	state = job->get_state(job);
 
-	sm_info("Activity id: %s Database state: %s", job->get_id(job), smc_job_state_str(state));
-
-	if (strcmp(job->get_subject(job), transport->atc_token->get_last_oneline(transport->atc_token)) != 0) {
-		if (!smc_only_owner_can_get_status) {
-			sm_debug("Subjects differs (%s!=%s). Returning only database state", 
-				job->get_subject(job), 
-				transport->atc_token->get_last_oneline(transport->atc_token));
-			goto out;
-		} else {
-			THROW_APP_FAULT(bes_factory_NotAuthorizedFault, "You are not authorized to get status of this activity");
-		}
-	}
-
+	sm_debug("Database state: %s", smc_job_state_str(state));
 
 	switch (state) {
@@ -344,5 +299,5 @@
 		case SMC_FAILED:
 		case SMC_CANCELLED:
-			sm_debug("Using database state due to final/staging job state");
+			sm_debug("Using database state");
 			goto out;
 		default:
@@ -352,5 +307,5 @@
 	/* If state is not final and is one of those that are monitored
 	 * periodically by the poller, ask DRMS for the most recent state. */
-	if ((status = get_drms_state(job, &drms_state)) == SM_FAULT)
+	if ((status = get_drms_state(job, &drms_state, &extra_info)) == SM_FAULT)
 		THROW_INTERNAL_FAULT("Couldn't contact DRMS to get the most recent state of an activity");
 	else if (status == SM_NEG)
@@ -362,27 +317,9 @@
 		sm_debug("Database state == DRMS state. That's OK.");
 		goto out;
-	} else {
-		sm_info("Activity id: %s DRMS state (%s) but returning Database state", job->get_id(job), smc_job_state_str(state));
-                /* one may think: why we are bothering of quering for DRMS status here if we always return database status. Yes, but... get_drms_state
-                   can trigger spawning a new session process and adding job to orphaned list (needed after restarting the service) */
-        }
-
-        /* 
-		13.03.2013 MM: This code may lead to deadlocks. Why?
-                
-                in theory:
-                
-                1. with get get_job_from_epr we acquire lock on the job a row
-                2. the session process wants to update job status, but it 
-                it has to wait because of lock acquired in 1. but it already has mutex on odbc object
-                3. create activity request comes but it can not acquire odbc object mutex
-                4. the get_drms_state request is blocked because session process is processing create activity
-
-                deadlock observed in practice
-             
-       
-
-	// * Now get a RW job object that is locked and update its state
-	 * according to DRMS state. * /
+	}
+
+
+	/* Now get a RW job object that is locked and update its state
+	 * according to DRMS state. */
 	SM_LIST_FREE_USER(jobs, smc_job_free);
 	SM_TRY_NOT_OK(get_job_from_epr(transport, fault, bes_factory__GetActivityStatuses->ActivityIdentifier, false, &jobs));
@@ -403,6 +340,9 @@
 	if (ret.code)
 		THROW_INTERNAL_FAULT("Couldn't update object in database");
-        */
+
 out:
+	SM_TRY_FAULT(status = smc_user_authorize(SMC_USER_AUTH_GET_STATUS, job->get_subject(job), transport->atc_token->get_last_oneline(transport->atc_token)));
+	if (status == SM_NEG)
+		THROW_APP_FAULT(bes_factory_NotAuthorizedFault, "You are not authorized to get status of this activity");
 
 	SM_TRY_NOT(bes_factory__GetActivityStatusesResponse->Response = transport->transport_malloc(transport, sizeof(*response)));
@@ -425,31 +365,31 @@
 		case SMC_QUEUED:
 			st->state = bes_factory__ActivityStateEnumeration__Pending;
-			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Queued;
-			SM_TRY_NOT(st->union_ActivityStatusType.qcf__Queued = soap_malloc(soap, sizeof(struct _qcf__Queued)));
+			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Queued;
+			SM_TRY_NOT(st->union_ActivityStatusType.qcg_comp_factory__Queued = soap_malloc(soap, sizeof(struct _qcg_comp_factory__Queued)));
 			break;
 		case SMC_STAGE_IN:
 			st->state = bes_factory__ActivityStateEnumeration__Pending;
-			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Stage_in;
-			SM_TRY_NOT(st->union_ActivityStatusType.qcf__Stage_in = soap_malloc(soap, sizeof(struct _qcf__Stage_in)));
+			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Stage_in;
+			SM_TRY_NOT(st->union_ActivityStatusType.qcg_comp_factory__Stage_in = soap_malloc(soap, sizeof(struct _qcg_comp_factory__Stage_in)));
 			break;
 		case SMC_HELD:
 			st->state = bes_factory__ActivityStateEnumeration__Pending;
-			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Held;
-			SM_TRY_NOT(st->union_ActivityStatusType.qcf__Held = soap_malloc(soap, sizeof(struct _qcf__Held)));
+			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Held;
+			SM_TRY_NOT(st->union_ActivityStatusType.qcg_comp_factory__Held = soap_malloc(soap, sizeof(struct _qcg_comp_factory__Held)));
 			break;
 		case SMC_EXECUTING:
 			st->state = bes_factory__ActivityStateEnumeration__Running;
-			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Executing;
-			SM_TRY_NOT(st->union_ActivityStatusType.qcf__Executing = soap_malloc(soap, sizeof(struct _qcf__Executing)));
+			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Executing;
+			SM_TRY_NOT(st->union_ActivityStatusType.qcg_comp_factory__Executing = soap_malloc(soap, sizeof(struct _qcg_comp_factory__Executing)));
 			break;
 		case SMC_STAGE_OUT:
 			st->state = bes_factory__ActivityStateEnumeration__Running;
-			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Stage_out;
-			SM_TRY_NOT(st->union_ActivityStatusType.qcf__Stage_out = soap_malloc(soap, sizeof(struct _qcf__Stage_out)));
+			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Stage_out;
+			SM_TRY_NOT(st->union_ActivityStatusType.qcg_comp_factory__Stage_out = soap_malloc(soap, sizeof(struct _qcg_comp_factory__Stage_out)));
 			break;
 		case SMC_SUSPENDED:
 			st->state = bes_factory__ActivityStateEnumeration__Running;
-			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcf__Suspended;
-			SM_TRY_NOT(st->union_ActivityStatusType.qcf__Suspended = soap_malloc(soap, sizeof(struct _qcf__Suspended)));
+			st->__union_ActivityStatusType = SOAP_UNION__bes_factory__union_ActivityStatusType_qcg_comp_factory__Suspended;
+			SM_TRY_NOT(st->union_ActivityStatusType.qcg_comp_factory__Suspended = soap_malloc(soap, sizeof(struct _qcg_comp_factory__Suspended)));
 			break;
 		case SMC_CANCELLED:
@@ -459,10 +399,10 @@
 			st->state = bes_factory__ActivityStateEnumeration__Finished;
 
-			SM_TRY_NOT(st->qcf__ActivityEndStatus = soap_malloc(soap, sizeof(struct qcf__ActivityEndStatus_USCOREType)));
-			soap_default_qcf__ActivityEndStatus_USCOREType(soap, st->qcf__ActivityEndStatus);
+			SM_TRY_NOT(st->qcg_comp_factory__ActivityEndStatus = soap_malloc(soap, sizeof(struct qcg_comp_factory__ActivityEndStatus_USCOREType)));
+			soap_default_qcg_comp_factory__ActivityEndStatus_USCOREType(soap, st->qcg_comp_factory__ActivityEndStatus);
 
 			if (job->has_exit_status(job)) {
-				SM_TRY_NOT(st->qcf__ActivityEndStatus->ExitStatus = soap_malloc(soap, sizeof(ULONG64)));
-				*(st->qcf__ActivityEndStatus->ExitStatus) = job->get_exit_status(job);
+				SM_TRY_NOT(st->qcg_comp_factory__ActivityEndStatus->ExitStatus = soap_malloc(soap, sizeof(ULONG64)));
+				*(st->qcg_comp_factory__ActivityEndStatus->ExitStatus) = job->get_exit_status(job);
 			}
 			break;
@@ -473,12 +413,12 @@
 			st->state = bes_factory__ActivityStateEnumeration__Failed;
 
-			SM_TRY_NOT(st->qcf__ActivityEndStatus = soap_malloc(soap, sizeof(struct qcf__ActivityEndStatus_USCOREType)));
-			soap_default_qcf__ActivityEndStatus_USCOREType(soap, st->qcf__ActivityEndStatus);
+			SM_TRY_NOT(st->qcg_comp_factory__ActivityEndStatus = soap_malloc(soap, sizeof(struct qcg_comp_factory__ActivityEndStatus_USCOREType)));
+			soap_default_qcg_comp_factory__ActivityEndStatus_USCOREType(soap, st->qcg_comp_factory__ActivityEndStatus);
 
 			if (job->get_posix_signal_name(job))
-				SM_TRY_NOT(st->qcf__ActivityEndStatus->POSIXSignalName = soap_strdup(soap, job->get_posix_signal_name(job)));
+				SM_TRY_NOT(st->qcg_comp_factory__ActivityEndStatus->POSIXSignalName = soap_strdup(soap, job->get_posix_signal_name(job)));
 			if (job->has_core_dumped(job)) {
-				SM_TRY_NOT(st->qcf__ActivityEndStatus->CoreDumped = soap_malloc(soap, sizeof(enum xsd__boolean)));
-				*(st->qcf__ActivityEndStatus->CoreDumped) = job->get_core_dumped(job);
+				SM_TRY_NOT(st->qcg_comp_factory__ActivityEndStatus->CoreDumped = soap_malloc(soap, sizeof(enum xsd__boolean)));
+				*(st->qcg_comp_factory__ActivityEndStatus->CoreDumped) = job->get_core_dumped(job);
 			}
 
@@ -505,19 +445,17 @@
 	}
 
-	if (job->get_ext_info(job)){
+	if (extra_info){
 		struct soap_dom_element *job_monitoring_dom = NULL;
 
-		sm_info("Activity info: %s", job->get_ext_info(job));
+		sm_info("Returning additional job information: %s", extra_info);
 
 		SM_TRY_NOT(job_monitoring_dom = transport->transport_malloc(transport, sizeof(*job_monitoring_dom)));
 
-		if (sm_gsoap_buffer_get_alloc_soap(job->get_ext_info(job), job_monitoring_dom, xsd__anyType, NULL, qcgcomp_namespaces, soap) != SM_OK)
-			THROW_INTERNAL_FAULT("Failed to parse job ActivityInfo element");
+		if (sm_gsoap_buffer_get_alloc_soap(extra_info, job_monitoring_dom, xsd__anyType, NULL, qcgcomp_namespaces, soap) != SM_OK)
+			THROW_INTERNAL_FAULT("Failed to parse job monitoring element");
 
 		st->__size = 1;
 		st->__any = job_monitoring_dom;
 
-	} else {
-		sm_info("No additional job information");
 	}
 
@@ -691,5 +629,5 @@
 	/* During staging the job doesn't have DRMS id yet. */
 	if (!parameter_sweep && job->get_drms_id(job))
-		SM_TRY_NOT(response->qcf__LocalActivityId = transport->transport_strdup(transport, job->get_drms_id(job)));
+		SM_TRY_NOT(response->qcg_comp_factory__LocalActivityId = transport->transport_strdup(transport, job->get_drms_id(job)));
 
 	SM_LIST_FREE_USER(jobs, smc_job_free);
@@ -714,6 +652,8 @@
 	struct sm_transport_fault_s faultstruct, *fault;
 	_bes_factory__FactoryResourceAttributesDocument *doc = NULL;
+	sm_list_t jobs = NULL;
+	sm_list_t factory_attr_list = NULL;
+	sm_list_t contained_resources_list = NULL;
 	sm_list_t subjects_list = NULL;
-	sm_list_t jobs = NULL;
 
 	sm_ret_code_t ret;
@@ -728,9 +668,7 @@
 	extern const char *smc_attributes_local_resource_manager_type;
 	extern char *smc_attributes_contained_resources;
-	extern sm_list_t smc_factory_attr_list;
 	extern char *smc_factory_attributes;
+	extern submission_module_t smc_sumbission_module;
 	extern sm_atz_module_t smc_mapfile_module;
-	extern sm_mutex_t smc_factory_attr_lock;
-	extern time_t smc_factory_attributes_timestamp;
 
 	SMC_FAULT_INIT;
@@ -742,8 +680,5 @@
 		return transport->fault(transport, fault);
 
-	sm_mutex_lock(&smc_factory_attr_lock);
-
-	SM_TRY_NOT(bes_factory__GetFactoryAttributesDocumentResponse->bes_factory__FactoryResourceAttributesDocument = 
-		transport->transport_malloc(transport, sizeof(*doc)));
+	SM_TRY_NOT(bes_factory__GetFactoryAttributesDocumentResponse->bes_factory__FactoryResourceAttributesDocument = transport->transport_malloc(transport, sizeof(*doc)));
 	doc = bes_factory__GetFactoryAttributesDocumentResponse->bes_factory__FactoryResourceAttributesDocument;
 	soap_default__bes_factory__FactoryResourceAttributesDocument(NULL, doc);
@@ -783,9 +718,29 @@
 			SM_TRY_NOT_OK(smc_create_activity_epr(transport, &doc->ActivityReference[i], job->get_id(job)));
 		}
-	} else {
-		doc->TotalNumberOfActivities = 0; // smc_job_count();
-  	}
-
-	/******* start of processing of factory attributes and contained resources *******/
+	} else
+		doc->TotalNumberOfActivities = smc_job_count();
+
+	if (!smc_attributes_local_resource_manager_type) { /*TODO race condition!!!*/
+		sm_value_t *value = smc_sumbission_module->get_drms((sm_module_t)smc_sumbission_module);
+		if (SM_VALUE_RET_CODE_OK(value[0])) {
+			int drms_type = value[1]->vint32;
+			char *drms_namespace = value[2]->vstring;
+			sm_debug("drms type = %d (ns=%s)" , drms_type, drms_namespace);
+
+			smc_attributes_local_resource_manager_type = sm_strdup(drms_namespace);
+		} else {
+			sm_error("get_drms() failed");
+		}
+		sm_value_free(&value);
+	}
+
+	SM_TRY_NOT_OK(sm_signal_emit("smc_contained_resources", smc_attributes_local_resource_manager_type, &contained_resources_list));
+
+	SM_ASSERT((sm_list_count(contained_resources_list) <= 1), "Only one handler can be connected to the smc_smc_contained_resources signal");
+
+	if (sm_list_count(contained_resources_list) == 1) {
+		SM_FREE(smc_attributes_contained_resources); /*TODO race condition !!!*/
+		smc_attributes_contained_resources = sm_strdup(((sm_value_t *)(contained_resources_list->data))[0]->vstring);
+	}
 
 	if (smc_attributes_contained_resources && strlen(smc_attributes_contained_resources)) {
@@ -842,6 +797,8 @@
 	}
 
-	if (smc_factory_attr_list) {
-		doc->__size = sm_list_count(smc_factory_attr_list);
+	SM_TRY_NOT_OK(sm_signal_emit("smc_factory_attributes", smc_attributes_local_resource_manager_type, &factory_attr_list));
+
+	if (factory_attr_list) {
+		doc->__size = sm_list_count(factory_attr_list);
 		sm_debug("smc_factory_attributes signal handled %d times", doc->__size);
 	} else
@@ -849,5 +806,4 @@
 
 	{
-		/* parse factory attributes from config file */
 		struct soap_dom_element *factory_attributes;
 		struct soap_dom_element *ptr;
@@ -886,17 +842,13 @@
 		int i = doc->__size - 1;
 
-		for (iter = smc_factory_attr_list; iter; iter = iter->next, i--) {
+		for (iter = factory_attr_list; iter; iter = iter->next, i--) {
 			sm_value_t *value = iter->data;
 
 			/* XXX: We assume the signal handler returns only one
 			 * XML element. */
-			if (sm_gsoap_buffer_get_alloc_soap(value[0]->vstring, &(doc->__any[i]), xsd__anyType, NULL, qcgcomp_namespaces, soap) != SM_OK) {
-				sm_error("Failed to parse FactoryAttributes retrieved from signal handler = %s", value[0]->vstring);
+			if (sm_gsoap_buffer_get_alloc_soap(value[0]->vstring, &(doc->__any[i]), xsd__anyType, NULL, qcgcomp_namespaces, soap) != SM_OK)
 				THROW_INTERNAL_FAULT("Failed to parse FactoryAttributes retrieved from signal handler");
-			}
-		}
-	}
-
-	/******* end of processing of factory attributes and contained resources *******/
+		}
+	}
 
 	SM_TRY_NOT(doc->NamingProfile = transport->transport_malloc(transport, sizeof(char **)));
@@ -932,12 +884,12 @@
 
 		if ((subjects_count = sm_list_count(subjects_list)) != 0) {
-			SM_TRY_NOT(doc->qcf__AuthorizedUsers = transport->transport_malloc(transport, sizeof(struct qcf__AuthorizedUsers_USCOREType)));
-			SM_TRY_NOT(doc->qcf__AuthorizedUsers->Subject = transport->transport_malloc(transport, sizeof(char *) * subjects_count));
-			doc->qcf__AuthorizedUsers->__sizeSubject = subjects_count;
+			SM_TRY_NOT(doc->qcg_comp_factory__AuthorizedUsers = transport->transport_malloc(transport, sizeof(struct qcg_comp_factory__AuthorizedUsers_USCOREType)));
+			SM_TRY_NOT(doc->qcg_comp_factory__AuthorizedUsers->Subject = transport->transport_malloc(transport, sizeof(char *) * subjects_count));
+			doc->qcg_comp_factory__AuthorizedUsers->__sizeSubject = subjects_count;
 		}
 
 		for (list_iter = subjects_list; list_iter; list_iter = list_iter->next) {
 			sm_debug("subject = %s", (char*)list_iter->data);
-			SM_TRY_NOT(doc->qcf__AuthorizedUsers->Subject[i++] = transport->transport_strdup(transport, (const char*)list_iter->data));
+			SM_TRY_NOT(doc->qcg_comp_factory__AuthorizedUsers->Subject[i++] = transport->transport_strdup(transport, (const char*)list_iter->data));
 		}
 
@@ -945,20 +897,13 @@
 
 	SM_LIST_FREE_USER(jobs, smc_job_free);
+	SM_LIST_FREE_USER(factory_attr_list, sm_value_free);
+	SM_LIST_FREE_USER(contained_resources_list, sm_value_free);
 	sm_list_free(subjects_list, SM_TRUE);
-
-        /* finally update VERSION number and timestamp */
-        doc->qcf__VersionString = VERSION;
-	SM_TRY_NOT(doc->qcf__Timestamp = transport->transport_malloc(transport, sizeof(*doc->qcf__Timestamp)));
-        *doc->qcf__Timestamp = smc_factory_attributes_timestamp;
-
-	sm_mutex_unlock(&smc_factory_attr_lock); 
-        
 	return transport->exit(transport, NULL);
 
 fault:
 	SM_LIST_FREE_USER(jobs, smc_job_free);
-	sm_list_free(subjects_list, SM_TRUE);
-
-	sm_mutex_unlock(&smc_factory_attr_lock); 
+	SM_LIST_FREE_USER(factory_attr_list, sm_value_free);
+	SM_LIST_FREE_USER(contained_resources_list, sm_value_free);
 
 	return transport->fault(transport, fault);
Index: trunk/src/modules/qcg_comp_service/jsdl.h
===================================================================
--- trunk/src/modules/qcg_comp_service/jsdl.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/jsdl.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_JSDL_H
Index: trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-factory.xsd
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-factory.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/jsdl-qcg-comp-factory.xsd
+link ../../../../schemas/interface/jsdl-smoa-comp-factory.xsd
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-ares.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-ares.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/qcg-comp-ares.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-ares.wsdl
+link ../../../../schemas/interface/smoa-comp-ares.wsdl
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-staging.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-staging.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/qcg-comp-staging.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-staging.wsdl
+link ../../../../schemas/interface/smoa-comp-staging.wsdl
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-factory.xsd
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-factory.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-factory.xsd
+link ../../../../schemas/interface/smoa-comp-factory.xsd
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-rsync.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-rsync.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/qcg-comp-rsync.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-rsync.wsdl
+link ../../../../schemas/interface/smoa-comp-rsync.wsdl
Index: trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-ares.xsd
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-ares.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/jsdl-qcg-comp-ares.xsd
+link ../../../../schemas/interface/jsdl-smoa-comp-ares.xsd
Index: trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-staging.xsd
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-staging.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/jsdl-qcg-comp-staging.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/jsdl-qcg-comp-staging.xsd
+link ../../../../schemas/interface/jsdl-smoa-comp-staging.xsd
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-ares.xsd
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-ares.xsd	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-ares.xsd
+link ../../../../schemas/interface/smoa-comp-ares.xsd
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-socks.wsdl
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-socks.wsdl	(revision 2)
+++ trunk/src/modules/qcg_comp_service/schemas/qcg-comp-socks.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../../../../schemas/interface/qcg-comp-socks.wsdl
+link ../../../../schemas/interface/smoa-comp-socks.wsdl
Index: trunk/src/modules/qcg_comp_service/schemas/qcg-comp-monitoring.xsd
===================================================================
--- trunk/src/modules/qcg_comp_service/schemas/qcg-comp-monitoring.xsd	(revision 62)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../../../schemas/interface/qcg-comp-monitoring.xsd
Index: trunk/src/modules/qcg_comp_service/qcg_comp_ares.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_ares.c	(revision 1109)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_ares.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -62,5 +55,4 @@
 extern const char *smc_reservations_administrator;
 extern uid_t smc_reservations_administrator_uid;
-
 
 static sm_status_ret_code_t
@@ -227,5 +219,4 @@
 
 fault:
-	sm_notice("Error while submitting ARDL:\n%s", SM_SAFE_STR(ardl_str));
 	sm_alloc_tracked_free(&tracked);
 	SM_FREE(username);
@@ -314,5 +305,5 @@
 	struct sm_transport_fault_s faultstruct, *fault;
 	smc_rsvn_t rsvn = NULL;
-	//sm_status_ret_code_t status;
+	sm_status_ret_code_t status;
 
 	SMC_FAULT_INIT;
@@ -325,9 +316,9 @@
 
 	SM_TRY_NOT_OK(get_rsvn_from_epr(transport, fault, &qcg_comp_ares__GetReservationDocument->ReservationIdentifier, true, &rsvn));
-	/* ARDLa are out of security concern
+
 	SM_TRY_FAULT(status = smc_user_authorize(SMC_USER_AUTH_GET_DOCUMENT, rsvn->get_subject(rsvn), transport->atc_token->get_last_oneline(transport->atc_token)));
 	if (status == SM_NEG)
 		THROW_APP_FAULT(qcg_comp_ares_NotAuthorizedFault, "You are not authorized to get document of this reservation");
-*/
+
 	SM_TRY_NOT(response->qcg_comp_ares__ReservationDocument = transport->transport_malloc(transport, sizeof(*response->qcg_comp_ares__ReservationDocument)));
 	SM_TRY_NOT(response->qcg_comp_ares__ReservationDocument->ardl__ReservationDefinition = transport->transport_malloc(transport, sizeof(*response->qcg_comp_ares__ReservationDocument->ardl__ReservationDefinition)));
@@ -433,6 +424,5 @@
 	sm_value_t *result = NULL;
 	sm_value_t *activities = NULL;
-	/* due to poor inula Postgresql preformance */
-	//sm_list_t jobs = NULL;
+	sm_list_t jobs = NULL;
 	smc_rsvn_t rsvn = NULL;
 	sm_list_t l;
@@ -441,5 +431,5 @@
 	sm_value_t *reserved_hosts = NULL;
 	uid_t uid;
-	//sm_status_ret_code_t status;
+	sm_status_ret_code_t status;
 	sm_ret_code_t ret;
 	struct qcg_comp_ares__ARESReservationStatus_USCOREType *res;
@@ -454,9 +444,9 @@
 
 	SM_TRY_NOT_OK(get_rsvn_from_epr(transport, fault, &qcg_comp_ares__GetReservationStatus->ReservationIdentifier, true, &rsvn));
-/* any regular user can get this information using standard commands
+
 	SM_TRY_FAULT(status = smc_user_authorize(SMC_USER_AUTH_GET_STATUS, rsvn->get_subject(rsvn), transport->atc_token->get_last_oneline(transport->atc_token)));
 	if (status == SM_NEG)
 		THROW_APP_FAULT(qcg_comp_ares_NotAuthorizedFault, "You are not authorized to get status of this reservation");
-*/
+
 	ret = smc_user_get_uid(rsvn->get_mapped_user(rsvn), &uid);
 	if (ret.code)
@@ -477,6 +467,4 @@
 	res = qcg_comp_ares__GetReservationStatusResponse->qcg_comp_ares__ReservationStatus;
 
-	/* due to poor inula Postgresql preformance */
-	/*
 	ret = smc_job_get_active_readonly(&jobs);
 	if (ret.code)
@@ -489,5 +477,4 @@
 			SM_TRY_NOT(sm_value_append(&activities, 1, SM_VALUE_STRING, j->get_id(j)));
 	}
-	*/
 
 	activities_count = sm_value_count(activities);
@@ -531,5 +518,5 @@
 		SM_TRY_NOT(hostname = soap_strdup(soap, hostname));
 
-		sm_info("reserved_host[%zu] = %s:%d:%d:%d", i, hostname, (int)*total_slots, (int)*reserved_slots, (int)*used_slots);
+		sm_debug("reserved_host[%zu] = %s:%d:%d:%d", i, hostname, (int)*total_slots, (int)*reserved_slots, (int)*used_slots);
 
 		res->ReservedHost[i].HostName = hostname;
@@ -539,6 +526,5 @@
 	}
 
-	/* !!! due to poor inula Postgresql performance */
-	//SM_LIST_FREE_USER(jobs, smc_job_free);
+	SM_LIST_FREE_USER(jobs, smc_job_free);
 	smc_rsvn_free(&rsvn);
 	sm_value_free(&params);
@@ -547,6 +533,5 @@
 
 fault:
-	/* !!! due to poor inula Postgresql performance */
-	//SM_LIST_FREE_USER(jobs, smc_job_free);
+	SM_LIST_FREE_USER(jobs, smc_job_free);
 	smc_rsvn_free(&rsvn);
 	sm_value_free(&params);
Index: trunk/src/modules/qcg_comp_service/qcg_comp_socks_serve.h
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_socks_serve.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_socks_serve.h	(revision 1)
@@ -1,22 +1,2 @@
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
 #ifndef CLIENT_H_
 #define CLIENT_H_
Index: trunk/src/modules/qcg_comp_service/faults.h
===================================================================
--- trunk/src/modules/qcg_comp_service/faults.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/faults.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_FAULTS_H
Index: trunk/src/modules/qcg_comp_service/bes_management.c
===================================================================
--- trunk/src/modules/qcg_comp_service/bes_management.c	(revision 612)
+++ trunk/src/modules/qcg_comp_service/bes_management.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -46,5 +39,5 @@
 };
 
-extern SM_BOOL smc_accepting_new_activities;
+SM_BOOL smc_accepting_new_activities = SM_TRUE;
 
 int
@@ -66,5 +59,4 @@
 		return transport->fault(transport, fault);
 
-	sm_error("StopAcceptingNewActivities is DISABLED");
 	THROW_INTERNAL_FAULT("BES management port disabled.");
 	/*
@@ -89,6 +81,4 @@
 	struct sm_transport_fault_s faultstruct, *fault;
 
-	SMC_FAULT_INIT;
-
 	if (transport->enter(transport, "StartAcceptingNewActivities", fault) != SM_OK)
 		return transport->fault(transport, fault);
@@ -97,5 +87,4 @@
 		return transport->fault(transport, fault);
 
-	sm_error("StartAcceptingNewActivities is DISABLED");
 	THROW_INTERNAL_FAULT("BES management port disabled.");
 	/*
Index: trunk/src/modules/qcg_comp_service/qcg_comp_service.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_service.c	(revision 963)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_service.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -35,10 +28,7 @@
 #include <qcg-core/privsep.h>
 #include <qcg-core/signal.h>
-#include <qcg-core/thread.h>
 #include <qcg-core/value.h>
 #include <qcg-core/xmalloc.h>
-#include <qcg-core/modules/atc_transport_module.h>
 #include <qcg-core/modules/atz_module.h>
-#include <qcg-core/modules/ecm_module.h>
 #include <qcg-core/modules/ecm_service_module.h>
 #include <qcg-core/modules/ecm_gsoap/ecm_gsoap.h>
@@ -56,4 +46,5 @@
 #include <stub/qcgcomp.nsmap>
 #include <stub/qcgcompStub.h>
+#include <include/submission_module.h>
 #include <qcg_comp_socks.h>
 
@@ -65,6 +56,4 @@
 static void qcg_comp_cleanup(sm_module_t this);
 static sm_value_t *reservation_vacuum(void *object sm_unused, sm_value_t *params sm_unused);
-static int post_transport_setup_callback(sm_transport_t transport sm_unused, void *data);
-static int get_drms_type(void);
 
 static const void *
@@ -116,44 +105,30 @@
 static bool smc_setuid_enabled = true;
 static unsigned int smc_reservation_vacuum_period = 300;
-static int ecm_modules_count = 0;
-static sm_thread_t monitor_thread = 0;
 
 const char *smc_attributes_common_name = NULL;
 const char *smc_attributes_long_description = NULL;
 const char *smc_reservations_administrator = NULL;
-const char *smc_unprivileged_user = NULL;
-unsigned int smc_rpolicy_max_duration = 168; /* 168 hours == one week */
-unsigned int smc_rpolicy_max_slots = 0; /* no limit */
 uid_t smc_reservations_administrator_uid;
 char *smc_attributes_local_resource_manager_type = NULL;
 char *smc_factory_attributes = NULL;
 char *smc_attributes_contained_resources = NULL;
-time_t smc_factory_attributes_timestamp = 0;
-SM_BOOL smc_return_list_of_activities = SM_FALSE;
+SM_BOOL smc_return_list_of_activities = SM_TRUE;
 SM_BOOL smc_return_list_of_contained_resources = SM_TRUE;
 SM_BOOL smc_only_owner_can_terminate = SM_TRUE;
-SM_BOOL smc_only_owner_can_get_status = SM_FALSE;
+SM_BOOL smc_only_owner_can_get_status = SM_TRUE;
 SM_BOOL smc_only_owner_can_get_document = SM_TRUE;
-SM_BOOL smc_use_database_state = SM_TRUE;
-SM_BOOL smc_use_scratch = SM_FALSE;
-SM_BOOL smc_accepting_new_activities = SM_TRUE;
-SM_BOOL smc_redirect_stdouterr = SM_FALSE;
-
-unsigned int smc_factory_attributes_lifetime = 300;
+submission_module_t smc_sumbission_module = NULL;
 sm_event_timer_subscription_t reservation_vacuum_subscription;
 sm_atz_module_t smc_mapfile_module = NULL;
-
-extern SM_BOOL session_process_exiting;
-extern sm_mutex_t smc_factory_attr_lock;
-extern SM_BOOL smc_exit_monitor;
 
 static int
 qcg_comp_setup(sm_module_t this)
 {
-	sm_list_t ecm_modules = NULL;
-	
+	const char *user = NULL;
+	struct passwd *pwd = NULL;
+
 	SM_DEBUG_ENTER();
 
-	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:UnprivilegedUser", &smc_unprivileged_user) == SM_FAULT)
+	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:UnprivilegedUser", &user) == SM_FAULT)
 		goto fault;
 
@@ -164,7 +139,4 @@
 		goto fault;
 
-	if (sm_conf_node_uint(this->conf_ctxt, SM_FALSE, "/conf:FactoryAttributesLifetime", &smc_factory_attributes_lifetime) == SM_FAULT)
-		goto fault;
-
 	if (sm_conf_node_bool(this->conf_ctxt, SM_FALSE, "/conf:ReturnListOfActivities", &smc_return_list_of_activities) == SM_FAULT)
 		goto fault;
@@ -181,30 +153,8 @@
 	if (sm_conf_node_bool(this->conf_ctxt, SM_FALSE, "/conf:OnlyOwnerCanGetDocument", &smc_only_owner_can_get_document) == SM_FAULT)
 		goto fault;
-	
-	if (sm_conf_node_bool(this->conf_ctxt, SM_FALSE, "/conf:UseDatabaseState", &smc_use_database_state) == SM_FAULT)
-		goto fault;
-
-	if (sm_conf_node_bool(this->conf_ctxt, SM_FALSE, "/conf:UseScratch", &smc_use_scratch) == SM_FAULT)
-		goto fault;
-
-	if (sm_conf_node_bool(this->conf_ctxt, SM_FALSE, "/conf:RedirectStdouterr", &smc_redirect_stdouterr) == SM_FAULT)
-		goto fault;
-
-	if (sm_conf_node_bool(this->conf_ctxt, SM_FALSE, "/conf:AcceptingNewActivities", &smc_accepting_new_activities) == SM_FAULT)
-		goto fault;
-
-	if (!smc_accepting_new_activities) {
-		sm_notice("The service is configured not to accept any new activities.");
-	}
-	
+
 	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:ReservationsAdministrator", &smc_reservations_administrator) == SM_FAULT)
 		goto fault;
 
-	if (sm_conf_node_uint(this->conf_ctxt, SM_FALSE, "/conf:ReservationsPolicy/conf:MaxDuration", &smc_rpolicy_max_duration) == SM_FAULT)
-		goto fault;
-
-	if (sm_conf_node_uint(this->conf_ctxt, SM_FALSE, "/conf:ReservationsPolicy/conf:MaxSlots", &smc_rpolicy_max_slots) == SM_FAULT)
-		goto fault;
-
 	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/conf:FactoryAttributes/conf:CommonName", &smc_attributes_common_name) == SM_FAULT)
 		goto fault;
@@ -222,63 +172,18 @@
 		goto fault;
 
-	if ((ecm_modules = this->module_manager->find_by_api2(this->module_manager, SM_API_ECM, SM_MODULE_SERVICE_MODE)) == NULL){
-		sm_error("Failed to find ECM service modules");
-		goto fault;
-	}
-
-	for (  ; ecm_modules; ecm_modules = ecm_modules->next) {
-	        if (((sm_ecm_module_t)ecm_modules->data)->add_post_setup_callback((sm_module_t) ecm_modules->data, post_transport_setup_callback, this) == SM_FAULT)
-			goto fault;
-
-		ecm_modules_count++;
-	}
-
-	return SM_OK;
-fault:
-	return SM_FAULT;
-}
-
-int
-post_transport_setup_callback(sm_transport_t transport, void *data)
-{
-	struct passwd *pwd = NULL;
-	sm_module_t this = (sm_module_t)data;
-        static int callback_count = 0;
-	static sm_list_t at_fork_callbacks = NULL;
-	struct sm_at_fork_callback_s at_fork_callback;
-	sm_atc_transport_module_t transport_module;
-	char *address;
-
-	SM_DEBUG_ENTER();
-
-	sm_debug("ecm_callback_count = %d, ecm_modules_count = %d ", ++callback_count, ecm_modules_count);
-	
-	if (transport->at_fork) {
-		sm_debug("Registering at_fork callback: %p", transport->at_fork);
-		at_fork_callback.cb_function = (sm_at_fork_cb_function)transport->at_fork;
-		at_fork_callback.cb_data = transport;
-
-		if (sm_list_add(&at_fork_callbacks, &at_fork_callback, sizeof(struct sm_at_fork_callback_s)) == NULL) 
-			goto fault;
-	}
-
-	if (callback_count < ecm_modules_count)
-		return SM_OK;
-	
-	if (!smc_unprivileged_user)
-		smc_unprivileged_user = DEFAULT_UNPRIVILEGED_USER;
-
-	if (!(pwd = getpwnam(smc_unprivileged_user))) {
+	if (!user)
+		user = DEFAULT_UNPRIVILEGED_USER;
+
+	if (!(pwd = getpwnam(user))) {
 		sm_perror("getpwnam");
-		sm_error("Couldn't get uid/gid for user %s", smc_unprivileged_user);
-		goto fault;
-	}
-
-	if (sm_privsep_setup(pwd->pw_uid, smc_session_process, !smc_setuid_enabled, at_fork_callbacks) != SM_OK) {
+		sm_error("Couldn't get uid/gid for user %s", user);
+		goto fault;
+	}
+
+	if (sm_privsep_setup(pwd->pw_uid, smc_session_process, !smc_setuid_enabled) != SM_OK) {
 		sm_error("Failed to set up privilege separation");
 		goto fault;
 	}
-	
-	sm_info("Dropping privileges. Since now running as %s", pwd->pw_name);
+
 	if (smc_reservations_administrator) {
 		if (!(pwd = getpwnam(smc_reservations_administrator))) {
@@ -292,4 +197,5 @@
 
 	/* Running as unprivileged user from now on. */
+
 	if (smc_db_setup(this->conf_ctxt) != SM_OK) {
 		sm_error("Failed to set up database module");
@@ -333,6 +239,16 @@
 	smc_extensions_add(SMC_NAMESPACE_SERVICE);
 
-        if (getenv("QCG_RSRV_NODES_PPN"))
-		smc_extensions_add(SMC_NAMESPACE_EXT_ADVANCE_RESERV_NODES);
+	/* Setup BES FactoryAttributes xsd:any type handler */
+	if (sm_signal_register("smc_factory_attributes", 0, (sm_value_type_t []) { SM_VALUE_STRING }, 1, (sm_value_type_t []) { SM_VALUE_STRING }, 1) !=  SM_OK)
+		goto fault;
+
+	/* Setup BES FactoryAttributes ContainedResources type handler */
+	if (sm_signal_register("smc_contained_resources", 0, (sm_value_type_t []) { SM_VALUE_STRING }, 1, (sm_value_type_t []) { SM_VALUE_STRING }, 1) !=  SM_OK)
+		goto fault;
+
+	if ((smc_sumbission_module = (submission_module_t)this->module_manager->find_by_api_first(this->module_manager, SUBMISSION_MODULE_API)) == NULL) {
+		sm_error("Submission module not found");
+		goto fault;
+	}
 
 	if (smc_socks_setup(this) == SM_FAULT) {
@@ -341,34 +257,9 @@
 	}
 
-	if (this->module_manager->find_by_api(this->module_manager, SM_API_ATZ) != NULL) {
-		smc_mapfile_module = (sm_atz_module_t)(this->module_manager->find_by_api(this->module_manager, SM_API_ATZ)->data);
-	} else {
-		SM_ASSERT(false, "No auhtorization module");
-	}
-
-	if (get_drms_type() == SM_FAULT) {
-		sm_error("Failed to determine DRMS type");
-		goto fault;
-	} else {
-		sm_info("Determined DRMS type: %s", smc_attributes_local_resource_manager_type);
-	}
-
-	if (sm_application_thread_create(&monitor_thread, NULL, smc_monitor_thread_loop, smc_attributes_local_resource_manager_type) != SM_OK) {
-		sm_error("Failed to create monitor thread");
-		goto fault;
-	}
-
-	sm_list_free(at_fork_callbacks, SM_TRUE);
-
-	transport_module = (sm_atc_transport_module_t) transport->atc_transport_modules->data;
-	address = transport_module->get_service_url((sm_module_t) transport_module, transport);
-
-	sm_info("Service address: %s", address);
-	SM_FREE(address);
+	smc_mapfile_module = (sm_atz_module_t)this->module_manager->find_by_name_first(this->module_manager, "atz_mapfile");
 
 	return SM_OK;
 
 fault:
-	sm_list_free(at_fork_callbacks, SM_TRUE);
 	smc_icomm_cleanup(this);
 	smc_job_cleanup();
@@ -378,5 +269,4 @@
 }
 
-
 static void
 qcg_comp_cleanup(sm_module_t this)
@@ -385,11 +275,4 @@
 
 	sm_event_timer_unsubscribe(&reservation_vacuum_subscription);
-
-	/* reuest termination and join monitor thread */
-	sm_mutex_lock(&smc_factory_attr_lock);
-	smc_exit_monitor = SM_TRUE;
-	sm_mutex_unlock(&smc_factory_attr_lock);
-	if (monitor_thread)
-		sm_thread_join(monitor_thread, NULL);
 
 	smc_jsdl_cleanup();
@@ -400,4 +283,7 @@
 	smc_socks_cleanup();
 
+	sm_signal_unregister("smc_factory_attributes");
+	sm_signal_unregister("smc_contained_resources");
+
 	SM_FREE(smc_attributes_local_resource_manager_type);
 	SM_FREE(smc_attributes_contained_resources);
@@ -446,28 +332,2 @@
 	return NULL;
 }
-
-int 
-get_drms_type(void)
-{
-	SM_DEBUG_ENTER();
-	sm_value_t *result = NULL;
-
-	if (smc_icomm_request_GetDRMS(getuid(), SM_VALUE_NONE_SINGLETON, &result) == SM_OK && SM_VALUE_RET_CODE_OK(result[0])) {
-		int drms_type = result[1]->vint32;
-		char *drms_namespace = result[2]->vstring;
-		sm_debug("drms type = %d (ns=%s)" , drms_type, drms_namespace);
-
-		if (!(smc_attributes_local_resource_manager_type = sm_strdup(drms_namespace)))
-			sm_error("get_drms() failed: OOM");
-	} else {
-		sm_error("get_drms() failed");
-		goto fault;
-	}
-
-	sm_value_free(&result);
-	return SM_OK;
-fault:
-	sm_value_free(&result);
-	return SM_FAULT;
-}	
-
Index: trunk/src/modules/qcg_comp_service/user.c
===================================================================
--- trunk/src/modules/qcg_comp_service/user.c	(revision 597)
+++ trunk/src/modules/qcg_comp_service/user.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <sys/types.h>
@@ -47,5 +40,4 @@
 
 extern struct Namespace qcgcomp_namespaces[];
-extern SM_BOOL smc_use_scratch;
 
 sm_ret_code_t
@@ -90,5 +82,4 @@
 	char buf[4096];
 	struct passwd pwd, *ptr = NULL;
-	struct stat statbuf;
 	int err;
 
@@ -99,16 +90,4 @@
 
 	*home = NULL;
-
-	if (smc_use_scratch && getenv("QCG_SCRATCH_DIR_ROOT")) {
-		if (!(*home = sm_asprintf("%s/%s", getenv("QCG_SCRATCH_DIR_ROOT"), username)))
-                	return sm_ret_code_create_oom();
-		if (stat(*home, &statbuf) == 0) {
-			return sm_ret_code_create_ok();
-		} else {
-			sm_debug("Failed to stat scratch directory. Falling back to scratch");
-			sm_free(*home);
-			*home = NULL;
-		}
-	} 
 
 	err = getpwnam_r(username, &pwd, buf, sizeof(buf), &ptr);
Index: trunk/src/modules/qcg_comp_service/qcg_comp_socks_server.c
===================================================================
--- trunk/src/modules/qcg_comp_service/qcg_comp_socks_server.c	(revision 338)
+++ trunk/src/modules/qcg_comp_service/qcg_comp_socks_server.c	(revision 1)
@@ -1,24 +1,17 @@
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -30,5 +23,4 @@
 
 #include <qcg-core/logger.h>
-#include <qcg-core/thread.h>
 #include <qcg-core/modules/modules.h>
 
@@ -83,7 +75,5 @@
 
 	++n;
-	if (!(sockets = sm_calloc(n, sizeof(int))))
-		goto fault;
-
+	sockets = sm_calloc(n, sizeof(int));
 	pos = 0;
 
@@ -235,5 +225,5 @@
 		fds = realloc(fds, n_fds * sizeof(struct pollfd));
 
-		sm_debug("poll table size %u (%u server sockets, %u client sockets)", (unsigned int)n_fds, (unsigned int)n_srv, (unsigned int)clients.n);
+		sm_debug("poll table size %u (%u server sockets, %u client sockets)", n_fds, n_srv, clients.n);
 
 		for(i=0 ; i<n_srv ; ++i) {
@@ -264,5 +254,5 @@
 		for(i=0 ; i<n_srv ; ++i) {
 
-			sm_debug("fds[%i].revents = %i", (int)i, (int)fds[i].revents);
+			sm_debug("fds[%i].revents = %i", i, fds[i].revents);
 
 			if(fds[i].revents & POLLIN)
Index: trunk/src/modules/qcg_comp_service/ardl.c
===================================================================
--- trunk/src/modules/qcg_comp_service/ardl.c	(revision 153)
+++ trunk/src/modules/qcg_comp_service/ardl.c	(revision 1)
@@ -2,19 +2,17 @@
 
 /*
- * QosCosGrid Notification
- * Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+ *  Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */
 
Index: trunk/src/modules/qcg_comp_service/user.h
===================================================================
--- trunk/src/modules/qcg_comp_service/user.h	(revision 338)
+++ trunk/src/modules/qcg_comp_service/user.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_USER_H
Index: trunk/src/modules/qcg_comp_service/monitoring.c
===================================================================
--- trunk/src/modules/qcg_comp_service/monitoring.c	(revision 654)
+++ 	(revision )
@@ -1,301 +1,0 @@
-/* $Id: bes_factory.c 312 2010-10-13 14:55:42Z mamonski $ */
-
-/*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
- */
-
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <qcg-core/sm.h>
-#include <qcg-core/access.h>
-#include <qcg-core/logger.h>
-#include <qcg-core/signal.h>
-#include <qcg-core/value.h>
-#include <qcg-core/thread.h>
-#include <qcg-core/xmalloc.h>
-#include <qcg-core/modules/modules.h>
-#include <qcg-core/modules/atz_module.h>
-#include <qcg-core/modules/ecm_gsoap/ecm_gsoap.h>
-#include <qcg-core/modules/ecm_gsoap/gsoap/gsoap_buffer.h>
-
-#include <common.h>
-#include <faults.h>
-#include <icomm.h>
-#include <identifiers.h>
-#include <job.h>
-#include <jsdl.h>
-#include <user.h>
-#include <stub/qcgcompStub.h>
-#include <stub/qcgcompH.h>
-#include <include/extensions.h>
-#include <include/jsdl_filter.h>
-#include <include/namespaces.h>
-
-
-__SM_ID("$Id: bes_factory.c 312 2010-10-13 14:55:42Z mamonski $");
-
-SM_INTERNAL_GENERAL_MODULE = {
-	.header = {
-		.name = "monitoring"
-	}
-};
-
-
-sm_mutex_t smc_factory_attr_lock = SM_MUTEX_INITIALIZER;
-sm_list_t smc_factory_attr_list = NULL;
-SM_BOOL smc_exit_monitor = SM_FALSE;
-time_t last_request = 0;
-
-extern char *smc_attributes_local_resource_manager_type;
-extern char *smc_attributes_contained_resources;
-extern int smc_factory_attributes_lifetime;
-extern time_t smc_factory_attributes_timestamp;
-
-void *
-smc_monitor_thread_loop(void *arg)
-{
-	char *drms_namespace = (char *)arg;
-        sm_value_t *params = NULL;
-        sm_value_t *result = NULL;
-        int request_counter = 0;
-	
-	SM_MANDATORY_P(arg);
-
-	sm_info("Starting resource manager monitor (DRMS=%s)", drms_namespace);
-
-	sm_mutex_lock(&smc_factory_attr_lock);
-	while (!smc_exit_monitor)
-	{
-		sm_mutex_unlock(&smc_factory_attr_lock);
-
-		if (time(NULL) - last_request >= smc_factory_attributes_lifetime) {
-			sm_info("Requesting refresh of factory attributes (age=%ds)",(int)(time(NULL) - last_request));
-
-			last_request = time(NULL);
-			request_counter++;
-
-			if ((params = sm_value_create( 2, SM_VALUE_STRING, smc_attributes_local_resource_manager_type, SM_VALUE_BOOL, (request_counter % 12 == 0))) == NULL) {
-				sm_error("Failed to create input params");
-				break;
-			}
-			
-			if (smc_icomm_request_GetDRMSInfos(getuid(), params, &result) == SM_OK && SM_VALUE_RET_CODE_OK(result[0])) {
-				char *contained_resources = NULL;
-				sm_list_t factory_attr_list = NULL;
-				size_t i;
-
-				//sanity check
-				SM_ASSERT(sm_value_count(result) >= 2, "sm_value_count(result) >= 2");
-				
-				if (!SM_VALUE_RET_CODE_OK(result[0])) {
-					sm_error("GetDRMSInfos failed");
-					sm_value_free(&result);
-					break;
-				}
-
-				if (!SM_VALUE_IS_NONE(result[1])) {
-					//sm_info("result = %s",  sm_value_debug(result));
-					assert(SM_VALUE_IS_STRING(result[1]));
-					contained_resources = sm_strdup(result[1]->vstring);
-					sm_debug("contained_resources = %s", contained_resources);
-				} else {
-					sm_notice("No containted resources reported");
-				}
-
-				for (i = 2; i < sm_value_count(result); i++) {
-					assert(SM_VALUE_IS_STRING(result[i]));
-					sm_list_add(&factory_attr_list, sm_value_create(1, SM_VALUE_STRING, result[i]->vstring), 0);
-					sm_debug("factory_attr[%d] = %s",(int)(i - 2), result[i]->vstring);
-				}
-
-				sm_value_free(&result);
-
-				sm_mutex_lock(&smc_factory_attr_lock);
-				if (contained_resources)
-					SM_FREE(smc_attributes_contained_resources);
-				if (factory_attr_list)
-					SM_LIST_FREE_USER(smc_factory_attr_list, sm_value_free);
-				
-				//update global variables
-				if (contained_resources)
-					smc_attributes_contained_resources = contained_resources;
-				if (factory_attr_list)
-					smc_factory_attr_list = factory_attr_list;
-				if (contained_resources && factory_attr_list)
-					smc_factory_attributes_timestamp = time(NULL);
-
-				sm_mutex_unlock(&smc_factory_attr_lock);
-
-			} else {
-				sm_error("GetDRMSInfos failed");
-			}	
-
-			sm_value_free(&params);
-		}
-		
-		sleep(1); 
-
-		sm_mutex_lock(&smc_factory_attr_lock);
-	}
-	
-	sm_info("Exiting resource manager monitor");
-	
-	sm_thread_exit(NULL);
-	return NULL; /*not reached*/
-}
-
-int
-smc_get_factory_attr(char *drms_type, char **contained_resources, sm_list_t *factory_attributes)
-{
-	sm_list_t contained_resources_list = NULL;
-
-	SM_DEBUG_ENTER();
-
-	if (sm_signal_emit("smc_contained_resources", drms_type, &contained_resources_list) != SM_OK) {
-		sm_error("smc_contained_resources signal failed.");
-		return SM_FAULT;
-	} 
-
-	SM_ASSERT((sm_list_count(contained_resources_list) <= 1), "Only one handler can be connected to the smc_attributes_contained_resources signal");
-
-	if (sm_list_count(contained_resources_list) == 1) {
-		if (!(*contained_resources = sm_strdup(((sm_value_t *)(contained_resources_list->data))[0]->vstring)) 
-			&& (((sm_value_t *)(contained_resources_list->data))[0]->vstring)) {
-			SM_LIST_FREE_USER(contained_resources_list, sm_value_free);
-			sm_error("Failed to allocate smc_attributes_contained_resources");
-			return SM_FAULT;
-		}
-	}
-
-	SM_LIST_FREE_USER(contained_resources_list, sm_value_free);
-
-	if (sm_signal_emit("smc_factory_attributes", drms_type, factory_attributes) != SM_OK) {
-		sm_error("smc_factory_atctributes signal failed.");
-		sm_free(*contained_resources);
-		return SM_FAULT;
-	}
-
-	return SM_OK;
-}
-
-void
-smc_get_job_stats(char *drms_type, SM_BOOL full_info)
-{
-	sm_list_t jobs = NULL;
-	sm_list_t ii = NULL;
-	sm_list_t job_info_list = NULL;
-	sm_value_t *drms_ids_array = NULL;
-	sm_value_t *drms_ids_array_clone = NULL;
-	sm_value_t *job_infos_array = NULL;
-	sm_ret_code_t ret;
-	int i;
-        static int call_numbers = 0;
-
-	SM_DEBUG_ENTER();
-
-	ret = smc_job_get_active_readonly(&jobs);
-
-	if (ret.code) {
-		sm_error("Failed to get active jobs list: %s ",ret.string);
-		goto fault;
-	}
-
-	/* 1. create SM_VALUE_ARRAY from sm_list_t of drms_id */
-	SM_TRY_NOT(drms_ids_array = sm_value_create(0));
-	for (ii = jobs; ii; ii = ii->next) {
-		smc_job_t job = ii->data;
-		if (job->get_drms_id(job)) { /* might be still in stage-in */
-			SM_TRY_NOT(sm_value_append(&drms_ids_array, 1, SM_VALUE_STRING,  job->get_drms_id(job)));
-		}
-	}
-	SM_TRY_NOT(drms_ids_array_clone = sm_value_clone(drms_ids_array));
-
-	SM_LIST_FREE_USER(jobs, smc_job_free);
-
-	/* debug drms_ids_array */	
-	{
-		char *drms_ids_array_debug = sm_value_debug(drms_ids_array);
-		sm_debug("drms_ids_array = %s  count = %d", drms_ids_array_debug, (int)sm_value_count(drms_ids_array));
-		SM_FREE(drms_ids_array_debug);
-	}
-
-	sm_info("Active jobs count = %d", (int)sm_value_count(drms_ids_array));
-
-	/* 2. emit signal */
-	if (sm_signal_emit("smc_jobs_info", drms_type, drms_ids_array, full_info, &job_info_list) != SM_OK) {
-			sm_error("smc_jobs_info signal failed.");
-			goto fault;
-	} 
-
-	drms_ids_array = drms_ids_array_clone; /*the sm_signal_emit frees input params*/
-	drms_ids_array_clone = NULL;
-
-	/* some sanity checks */
-	SM_ASSERT((sm_list_count(job_info_list) <= 1), "Only one handler can be connected to the smc_jobs_info signal");
-	
-	if (sm_list_count(job_info_list) != 1) {
-		sm_notice("No smc_job_info handler registered");
-		goto fault;
-	}
-
-	assert(SM_VALUE_IS_ARRAY(((sm_value_t *)job_info_list->data)[0]));
-
-	job_infos_array = ((sm_value_t *)job_info_list->data)[0]->varray;
-
-	if (sm_value_count(job_infos_array) != sm_value_count(drms_ids_array)) {
-		sm_error("Number of job ext info elments differs from number of active jobs: %d != %d", (int)sm_value_count(job_infos_array), (int)sm_value_count(drms_ids_array));
-		goto fault;
-	}
-	
-	/* 3. save ext info */
-	for (i = 0; i < (int)sm_value_count(drms_ids_array); i++) {
-		assert(SM_VALUE_IS_STRING(job_infos_array[i]));
-		
-		if (job_infos_array[i]->vstring && strlen(job_infos_array[i]->vstring)) {
-			char *drms_id = drms_ids_array[i]->vstring;
-			char *ext_info = job_infos_array[i]->vstring;
-			smc_job_t job = NULL;
-			sm_debug("Using ext info %s for job: %s", ext_info,  drms_id);
-
-			ret = smc_job_get_by_drms_id(drms_id, &job);	
-			if (ret.code) {
-				sm_info("Failed to get job %s from database. Already terminated?", drms_id); // job may have terminated already
-				break; 
-			}
-
-			job->set_ext_info(job, ext_info);
-			job->save(job);
-			smc_job_free(&job);
-	
-		} else {
-			sm_debug("No ext info for job: %s", drms_ids_array[i]->vstring);
-		}
-	}
-
-        /* this method is called in one shot handler, dont bother with freeing allocated, but leve this assert in case someone would want to call it many times */
-        SM_ASSERT(++call_numbers == 1, "The smc_get_job_stats should be called only once");
-        return;
-fault:
-	sm_error("Failed to refresh job stats");
-}
Index: trunk/src/modules/Makefile.am
===================================================================
--- trunk/src/modules/Makefile.am	(revision 1109)
+++ trunk/src/modules/Makefile.am	(revision 1)
@@ -11,9 +11,7 @@
 	  sge_jsdl_filter \
 	  pbs_jsdl_filter \
-	  pbspro_jsdl_filter \
-	  slurm_jsdl_filter \
-	  ll_jsdl_filter \
 	  atz_ardl_filter \
 	  atz_sandbox \
+	  monitoring_drms \
 	  python \
 	  notification_wsn \
@@ -30,3 +28,6 @@
 endif
 
+if WITH_LIBACTIVEMQ_CPP
+SUBDIRS += bat_updater
+endif
 
Index: trunk/src/modules/monitoring_drms/Makefile.am
===================================================================
--- trunk/src/modules/monitoring_drms/Makefile.am	(revision 1)
+++ trunk/src/modules/monitoring_drms/Makefile.am	(revision 1)
@@ -0,0 +1,13 @@
+# $Id: Makefile.am 2312 2009-04-15 17:31:24Z mmamonski $
+
+moduleexec_LTLIBRARIES = monitoring_drms.la
+
+monitoring_drms_la_SOURCES = monitoring_drms.c
+
+monitoring_drms_la_CPPFLAGS = \
+				 -DSM_MODULE \
+				 -I$(top_srcdir)/src \
+				 $(QCG_CORE_CPPFLAGS)
+
+monitoring_drms_la_LIBADD = $(QCG_CORE_LIBS) 
+monitoring_drms_la_LDFLAGS = -module -avoid-version -rpath $(moduleexecdir)
Index: trunk/src/modules/monitoring_drms/monitoring_drms.c
===================================================================
--- trunk/src/modules/monitoring_drms/monitoring_drms.c	(revision 1)
+++ trunk/src/modules/monitoring_drms/monitoring_drms.c	(revision 1)
@@ -0,0 +1,198 @@
+/* $Id: monitoring_drms.c 66 2010-03-31 15:26:16Z mamonski $ */
+
+/*
+ * Copyright 2006-2009 QCG Project Team
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+
+#include <qcg-core/sm.h>
+#include <qcg-core/list.h>
+#include <qcg-core/logger.h>
+#include <qcg-core/python.h>
+#include <qcg-core/utils.h>
+#include <qcg-core/value.h>
+#include <qcg-core/signal.h>
+#include <qcg-core/xmalloc.h>
+#include <qcg-core/modules/modules.h>
+
+__SM_ID("$Id: monitoring_drms.c 66 2010-03-31 15:26:16Z mamonski $");
+
+typedef struct reservation_python_ctxt_s {
+	char *module_name;
+	sm_python_object_t module;
+} *reservation_python_ctxt_t;
+
+static int setup(sm_module_t);
+static void cleanup(sm_module_t);
+
+static sm_value_t *factory_attr_handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
+static sm_value_t *contained_resources_handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
+static sm_value_t *job_info_handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params);
+
+SM_GENERAL_MODULE = {
+
+	.header = {
+		.entry_size = SM_GENERAL_MODULE_ENTRY_SIZE,
+		.api_type = SM_API_GENERAL,
+
+		.name = "monitoring_drms",
+		.descr = "Cluster monitoring module",
+
+		.version_major = 0,
+		.version_minor = 1,
+
+		.setup = setup,
+		.cleanup = cleanup,
+
+		.multiple_instances_supported = SM_FALSE
+	},
+};
+
+static int
+setup(sm_module_t this)
+{
+	char *base = NULL, *p = NULL, *config_xml = NULL;
+	const char *path = NULL;
+	reservation_python_ctxt_t ctxt = NULL;	
+
+	SM_DEBUG_ENTER();
+	
+	if (!(ctxt = sm_malloc(sizeof(*ctxt))))
+		goto fault;
+
+	if (sm_conf_node_str(this->conf_ctxt, SM_FALSE, "/@path", &path) != SM_OK)
+		goto fault;
+
+	if (sm_conf_node_raw(this->conf_ctxt, SM_TRUE, "/", &config_xml) != SM_OK)
+		goto fault;
+
+	if (!(base = sm_basename(path)))
+		goto fault;
+
+	if ((p = strchr(base, '.')))
+		*p = '\0';
+
+	ctxt->module_name = base;
+
+	sm_info("Setting up: %s", path);
+
+	if (!(ctxt->module = sm_python_load_module(path, config_xml,
+					sm_conf_ctxt_get_default_prefix(this->conf_ctxt),
+					sm_conf_ctxt_get_service_prefix(this->conf_ctxt),
+					sm_conf_ctxt_get_service_namespace(this->conf_ctxt)))) {
+		sm_error("Failed to load module: %s", path);
+		goto fault;
+	}
+	
+	if (!sm_python_object_has_attr(ctxt->module, "go", SM_TRUE)) {
+		sm_error("The module doesn't define go function");
+		goto fault;
+	}
+
+	SM_TRY_FAULT(sm_signal_connect("smc_factory_attributes", factory_attr_handler));
+	SM_TRY_FAULT(sm_signal_connect("smc_contained_resources", contained_resources_handler));
+	SM_TRY_FAULT(sm_signal_connect("smc_job_info", job_info_handler));
+
+	SM_FREE(config_xml);
+
+	this->ctxt = ctxt;
+
+	return SM_OK;
+
+fault:
+
+	if (ctxt->module)
+		sm_python_unload_module(base);
+	SM_FREE(base);
+	SM_FREE(config_xml);
+	SM_FREE(ctxt);
+	return SM_FAULT;
+}
+
+static void
+cleanup(sm_module_t this sm_unused)
+{
+	reservation_python_ctxt_t ctxt;
+	SM_DEBUG_ENTER();
+
+	if (!this->ctxt)
+		return;
+
+	ctxt = this->ctxt;
+
+	sm_python_unload_module(ctxt->module_name);
+	SM_FREE(this->ctxt);
+}
+
+static sm_value_t *
+factory_attr_handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
+{
+	sm_info("factory_attr handler called for DRMS type: %s", params[0]->vstring);
+
+	return sm_value_create(1, SM_VALUE_STRING, "<ClusterMonitoring xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/monitoring\"> \
+			<Queues> \
+			 <Queue name='short' walltime='xml duration' default='true' priority='30' maxJobs='100' runningJobs='20' waitingJobs='40'/> \
+			</Queues> \
+			<Reservations> \
+			<Reservation name='foo' type='ar' startTime='XMLdate' endTime='opcjonalny' owner='versor' > \
+				<Resource name='grass1' reservedSlots='3'/> \
+			</Reservation> \
+			</Reservations> \
+			</ClusterMonitoring>");
+}
+
+static sm_value_t *
+contained_resources_handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
+{
+	char *contained_resources = {"<ContainedResources xmlns:bes-factory=\"http://schemas.ggf.org/bes/2006/08/bes-factory\" xmlns:jsdl=\"http://schemas.ggf.org/jsdl/2005/11/jsdl\">\
+                                        <ContainedResource>\
+                                                <bes-factory:ResourceName>alpha.example.com</bes-factory:ResourceName>\
+                                                <bes-factory:CPUArchitecture>\
+                                                        <jsdl:CPUArchitectureName>x86_64</jsdl:CPUArchitectureName>\
+                                                </bes-factory:CPUArchitecture>\
+												<bes-factory:CPUCount>10</bes-factory:CPUCount>\
+                                                <bes-factory:PhysicalMemory>1073741824</bes-factory:PhysicalMemory>\
+                                                <bes-factory:VirtualMemory>1073741824</bes-factory:VirtualMemory>\
+                                                <Utilization xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/monitoring\">100</Utilization> \
+                                        </ContainedResource>\
+                                        <ContainedResource>\
+                                                <bes-factory:ResourceName>beta.example.com</bes-factory:ResourceName>\
+                                                <bes-factory:CPUArchitecture>\
+                                                        <jsdl:CPUArchitectureName>x86_64</jsdl:CPUArchitectureName>\
+                                                </bes-factory:CPUArchitecture>\
+                                                <bes-factory:CPUCount>2</bes-factory:CPUCount>\
+                                                <bes-factory:PhysicalMemory>1073741824</bes-factory:PhysicalMemory>\
+                                                <Utilization xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/monitoring\">100</Utilization> \
+                                        </ContainedResource>\
+                                </ContainedResources>"};
+
+	sm_info("contained_resources_handler handler called for DRMS type: %s", params[0]->vstring);
+
+	return sm_value_create(1, SM_VALUE_STRING, contained_resources);
+}
+
+static sm_value_t *
+job_info_handler(sm_signal_t signal, sm_value_t *params, const sm_value_t *chained_params)
+{
+	assert(SM_VALUE_IS_STRING(params[0]));
+	assert(SM_VALUE_IS_STRING(params[1]));
+	sm_info("job_info_handler  called for local job id: %s (DRMS type = %s)", params[0]->vstring, params[1]->vstring);
+
+	return sm_value_create(1, SM_VALUE_STRING, "<JobMonitoring xmlns=\"http://schemas.qoscosgrid.org/comp/2011/04/monitoring\"> \
+			<ExecutionHosts><Host name='alpha.example.com'/></ExecutionHosts><CPUTimeUsage>1:00:00</CPUTimeUsage><MemUsage>4000000</MemUsage></JobMonitoring>");
+}
+
+
Index: trunk/src/modules/reservation_ares/reservation_ares.c
===================================================================
--- trunk/src/modules/reservation_ares/reservation_ares.c	(revision 338)
+++ trunk/src/modules/reservation_ares/reservation_ares.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <sys/types.h>
@@ -339,12 +332,13 @@
 
 	if ((resources = description->ardl__Resources)) {
+		struct jsdl__CPUArchitecture_USCOREType *cpu;
 
 		if (resources->ReservedSlotsCount) {
-			snprintf(buf, sizeof(buf), "%u", (unsigned int)*resources->ReservedSlotsCount);
+			snprintf(buf, sizeof(buf), "%llu", *resources->ReservedSlotsCount);
 			if ((ret = ares_set_reservation_attribute(at, ARES_N_SLOTS, buf, errbuf, sizeof(errbuf))) != ARES_ERRNO_SUCCESS) goto fault;
 		}
 
 		if (resources->AdditionalReservedSlotsCount) {
-			snprintf(buf, sizeof(buf), "%u", (unsigned int)*resources->AdditionalReservedSlotsCount);
+			snprintf(buf, sizeof(buf), "%llu", *resources->AdditionalReservedSlotsCount);
 			if ((ret = ares_set_reservation_attribute(at, ARES_ADDITIONAL_N_SLOTS, buf, errbuf, sizeof(errbuf))) != ARES_ERRNO_SUCCESS) goto fault;
 		}
@@ -361,4 +355,8 @@
 			if ((ret = ares_set_reservation_attribute(at, ARES_RESERVATION_GROUP, resources->GroupName, errbuf, sizeof(errbuf))) != ARES_ERRNO_SUCCESS) goto fault;
 
+		if ((cpu = resources->CPUArchitecture)) {
+			const char *name = soap__jsdl__CPUArchitectureName2s(NULL, cpu->jsdl__CPUArchitectureName);
+			if ((ret = ares_set_reservation_attribute(at, ARES_ARCHITECTURE, name, errbuf, sizeof(errbuf))) != ARES_ERRNO_SUCCESS) goto fault;
+		}
 
 		if (resources->CandidateHosts && resources->CandidateHosts->__sizeHostName) {
@@ -381,9 +379,19 @@
 			int count = resources->__sizeNativeResource;
 			char **native = sm_alloc_tracked_calloc(tracked, count + 1, sizeof(char *));
+			int i;
 
 			if (!native)
 				goto fault;
 
-
+			for (i = 0; i < count; i++) {
+				 if (!resources->NativeResource[i].__item || strcmp("", resources->NativeResource[i].__item) == 0)
+					 native[i] = resources->NativeResource[i].name; /* boolean resource (e.g.: "openmpi") */
+				 else {
+					 /* other resources (e.g.: "mem=1000") */
+					 SM_TRY_NOT(native[i] = sm_alloc_tracked_asprintf(tracked, "%s=%s",resources->NativeResource[i].name, resources->NativeResource[i].__item));
+				 }
+			}
+
+			native[count] = NULL;
 
 			if ((ret = ares_set_vector_reservation_attribute(at, ARES_V_NATIVE_RESOURCES, (const char**) native, errbuf, sizeof(errbuf))) != ARES_ERRNO_SUCCESS) goto fault;
Index: trunk/src/modules/reservation_ares/ares.h
===================================================================
--- trunk/src/modules/reservation_ares/ares.h	(revision 153)
+++ trunk/src/modules/reservation_ares/ares.h	(revision 1)
@@ -2,19 +2,17 @@
 
 /*
- * QosCosGrid Notification
- * Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *  Copyright 2006-2009 QCG Project Team
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */
 
Index: trunk/src/modules/qcg_coordinator_client/qcg_coordinator_client.h
===================================================================
--- trunk/src/modules/qcg_coordinator_client/qcg_coordinator_client.h	(revision 338)
+++ trunk/src/modules/qcg_coordinator_client/qcg_coordinator_client.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __ECM_QCG_COORDINATOR_CLIENT_H
@@ -53,5 +46,7 @@
 	smc_coordinator_process_entry_t result;
 
-	if (!(result = sm_malloc(sizeof(*result)))) {
+	result = sm_malloc(sizeof(*result));
+
+	if (result == NULL) {
 		return NULL;
 	}
Index: trunk/src/modules/qcg_coordinator_client/qcgcoordinator.wsdl
===================================================================
--- trunk/src/modules/qcg_coordinator_client/qcgcoordinator.wsdl	(revision 2)
+++ trunk/src/modules/qcg_coordinator_client/qcgcoordinator.wsdl	(revision 1)
@@ -1,1 +1,1 @@
-link ../qcg_coordinator_service/stub/qcgcoordinator.wsdl
+link ../smoa_coordinator_service/stub/smoacoordinator.wsdl
Index: trunk/src/modules/qcg_coordinator_client/qcg_coordinator_client.c
===================================================================
--- trunk/src/modules/qcg_coordinator_client/qcg_coordinator_client.c	(revision 338)
+++ trunk/src/modules/qcg_coordinator_client/qcg_coordinator_client.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -272,6 +265,5 @@
 		if (response.__sizeProcessEntry > 0) {
 			*size_out = response.__sizeProcessEntry;
-			if (!(*out = sm_malloc(sizeof(smc_coordinator_process_entry_t) * (*size_out))))
-				return SM_FAULT;
+			*out = sm_malloc(sizeof(smc_coordinator_process_entry_t) * (*size_out));
 
 			for (i = 0; i < (*size_out); i++) {
Index: trunk/src/modules/atz_sandbox/atz_sandbox.c
===================================================================
--- trunk/src/modules/atz_sandbox/atz_sandbox.c	(revision 338)
+++ trunk/src/modules/atz_sandbox/atz_sandbox.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
@@ -194,4 +187,124 @@
 }
 
+/*
+static int
+atz_sandbox_readline(const regex_t *regex, FILE *sandbox_fd, char **remote_subject, char **mappings, char **routines)
+{
+	char buf[sandbox_LINE_MAXLEN + 1];
+	regmatch_t pmatch[4];
+
+nextline:
+	if (fgets(buf, sizeof(buf), sandbox_fd)) {
+		char *ptr;
+
+		if ((ptr = strchr(buf, '\r')))
+			*ptr = '\0';
+		if ((ptr = strchr(buf, '\n')))
+			*ptr = '\0';
+
+		if (buf[0] == '#' || buf[0] == '\0')
+			goto nextline;
+
+		if (regexec(regex, buf, 4, pmatch, 0)) {
+			sm_notice("Ignoring line: \"%s\"", buf);
+			goto nextline;
+		}
+
+		*remote_subject = sm_malloc(pmatch[1].rm_eo - pmatch[1].rm_so + 2);
+		*mappings = sm_malloc(pmatch[2].rm_eo - pmatch[2].rm_so + 2);
+
+		if (pmatch[3].rm_so == -1) {
+			*routines = sm_strdup("*");
+		} else {
+			*routines = sm_malloc(pmatch[3].rm_eo - pmatch[3].rm_so + 2);
+		}
+
+		if (NULL == *remote_subject || NULL == *mappings || NULL == *routines) {
+			SM_FREE(*remote_subject);
+			SM_FREE(*mappings);
+			SM_FREE(*routines);
+			return SM_FAULT;
+		}
+
+		buf[pmatch[1].rm_eo] = '\0';
+		strcpy(*remote_subject, buf + pmatch[1].rm_so);
+		buf[pmatch[2].rm_eo] = '\0';
+		strcpy(*mappings, buf + pmatch[2].rm_so);
+
+		if (pmatch[3].rm_so != -1) {
+			buf[pmatch[3].rm_eo] = '\0';
+			strcpy(*routines, buf + pmatch[3].rm_so);
+		}
+
+		sm_debug("Read: |%s|%s|%s|", *remote_subject, *mappings, *routines);
+	} else {
+		if (ferror(sandbox_fd)) {
+			sm_error("fgets failed");
+			clearerr(sandbox_fd);
+		}
+		return SM_FAULT;
+	}
+
+	return SM_OK;
+}
+
+static int
+atz_sandbox_get_data(const char *path, const regex_t *regex, const char *subject, char **mapping, char **routines)
+{
+	char *sandbox_subject = NULL;
+	char *sandbox_mappings = NULL;
+	char *sandbox_routines = NULL;
+	FILE *sandbox_fd = NULL;
+
+	SM_MANDATORY_PARAM(path, SM_FAULT);
+	SM_MANDATORY_PARAM(regex, SM_FAULT);
+	SM_MANDATORY_PARAM(subject, SM_FAULT);
+
+	SM_DEBUG_ENTER_STR(subject);
+
+	if (!(sandbox_fd = fopen(path, "r"))) {
+		sm_perror("fopen");
+		return SM_FAULT;
+	}
+
+	sm_debug("Opened sandbox: %s", path);
+
+	while (SM_OK == atz_sandbox_readline(regex, sandbox_fd, &sandbox_subject, &sandbox_mappings, &sandbox_routines)) {
+
+		if (!strcmp(subject, sandbox_subject)) {
+
+			fclose(sandbox_fd);
+			sandbox_fd = NULL;
+
+			SM_FREE(sandbox_subject);
+
+			if (mapping)
+				*mapping = sandbox_mappings;
+			else
+				SM_FREE(sandbox_mappings);
+
+			if (routines)
+				*routines = sandbox_routines;
+			else
+				SM_FREE(sandbox_routines);
+
+			return SM_OK;
+		} else {
+			SM_FREE(sandbox_subject);
+			SM_FREE(sandbox_mappings);
+			SM_FREE(sandbox_routines);
+		}
+	}
+
+	SM_FREE(sandbox_subject);
+	SM_FREE(sandbox_mappings);
+	SM_FREE(sandbox_routines);
+	fclose(sandbox_fd);
+
+	sm_notice("Unknown user: %s", subject);
+	return SM_NEG;
+}
+*/
+
 static int
 atz_sandbox_authorize(sm_module_t this, sm_atc_token_t atc_token, const char *routine)
@@ -214,6 +327,5 @@
 		} else {
 			/*2. let the the service deduce the user using context available in message (e.g.: activity id) */
-			if (!(mapped_user = sm_strdup(SM_ACCESS_ANY)))
-				goto out;
+			mapped_user = sm_strdup(SM_ACCESS_ANY);
 		}
 	} else {
@@ -239,5 +351,4 @@
 	}
 
-out:
 	return ret;
 }
Index: trunk/src/modules/atz_sandbox/db_sandbox.c
===================================================================
--- trunk/src/modules/atz_sandbox/db_sandbox.c	(revision 338)
+++ trunk/src/modules/atz_sandbox/db_sandbox.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifdef HAVE_CONFIG_H
Index: trunk/src/modules/atz_sandbox/db_sandbox.h
===================================================================
--- trunk/src/modules/atz_sandbox/db_sandbox.h	(revision 338)
+++ trunk/src/modules/atz_sandbox/db_sandbox.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_DB_SANDBOX_H
Index: trunk/src/modules/notification_wsn/notification_wsn.c
===================================================================
--- trunk/src/modules/notification_wsn/notification_wsn.c	(revision 547)
+++ trunk/src/modules/notification_wsn/notification_wsn.c	(revision 1)
@@ -2,22 +2,17 @@
 
 /*
- * QosCosGrid Notification
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ *  Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */
 
@@ -82,5 +77,4 @@
 static sm_ecm_client_module_t ntf_module;
 static char *np_service_url = NULL;
-static SM_BOOL initialized = SM_FALSE;
 
 SM_GENERAL_MODULE = {
@@ -108,9 +102,4 @@
 
 	SM_DEBUG_ENTER();
-
-	if (initialized)
-		return SM_OK;
-	
-	initialized = SM_TRUE;
 
 	ret  = sm_signal_connect("smc_job_queued", handle_queued);
@@ -139,6 +128,5 @@
 	ntf_api = ntf_module->client_api;
 
-	if (sm_conf_node_strdup(this->conf_ctxt, SM_FALSE, "/conf:PublishedBrokerURL", &np_service_url) == SM_FAULT)
-		return SM_FAULT;
+
 
 	// TODO registration
Index: trunk/src/modules/staging_curl/staging_curl.c
===================================================================
--- trunk/src/modules/staging_curl/staging_curl.c	(revision 338)
+++ trunk/src/modules/staging_curl/staging_curl.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #define _FILE_OFFSET_BITS	64
Index: trunk/src/modules/python/Makefile.am
===================================================================
--- trunk/src/modules/python/Makefile.am	(revision 1109)
+++ trunk/src/modules/python/Makefile.am	(revision 1)
@@ -7,11 +7,3 @@
 	  reservation_sge \
 	  reservation_maui \
-	  reservation_moab \
-	  reservation_pbs \
-	  reservation_slurm \
-	  reservation_ll \
-	  factory_attr_example \
-	  plgrid_info \
-	  modules_info \
-	  ganglia_info \
-	  vo_info
+	  factory_attr_example
Index: trunk/src/modules/python/factory_attr_example/factory_attr.py
===================================================================
--- trunk/src/modules/python/factory_attr_example/factory_attr.py	(revision 304)
+++ trunk/src/modules/python/factory_attr_example/factory_attr.py	(revision 1)
@@ -3,21 +3,17 @@
 # vim: set ts=4 sw=4 et:
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+
+
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 from qcg.core import *
Index: trunk/src/modules/python/jsdl_filter_example/jsdl_filter.py
===================================================================
--- trunk/src/modules/python/jsdl_filter_example/jsdl_filter.py	(revision 304)
+++ trunk/src/modules/python/jsdl_filter_example/jsdl_filter.py	(revision 1)
@@ -3,21 +3,15 @@
 # vim: set ts=4 sw=4 et:
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 try:
Index: trunk/src/modules/python/reservation_maui/reservation_maui.py
===================================================================
--- trunk/src/modules/python/reservation_maui/reservation_maui.py	(revision 304)
+++ trunk/src/modules/python/reservation_maui/reservation_maui.py	(revision 1)
@@ -3,21 +3,15 @@
 # vim: set ts=4 sw=4 et:
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 try:
@@ -45,5 +39,4 @@
 from commands import getstatusoutput
 import re
-import os
 from qcg.core import *
 from qcg.comp import *
@@ -72,5 +65,5 @@
     pass
 
-class ReservationMaui(Module):
+class ReservationSGE(Module):
 
     def convertTime(self, dt):
@@ -137,5 +130,5 @@
         # TODO
         unsupported = ("FileSystem", "OperatingSystem", "CPUArchitecture",
-         "NativeResource")
+        "IndividualPhysicalMemory", "IndividualSwapMemory", "NativeResource", "ReservationName")
 
         for u in unsupported:
@@ -148,5 +141,5 @@
 
         cmd = "setres -x BYNAME -r PROCS=1"
-   
+    
         try:
             cmd += ":MEM=" + resources.find(ns + "IndividualPhysicalMemory").text
@@ -155,17 +148,10 @@
     
         try:
-            cmd += ":SWAP=" + resources.find(ns + "IndividualSwapMemory").text
+                cmd += ":SWAP=" + resources.find(ns + "IndividualSwapMemory").text
         except:
             pass
     
         cmd += " "
-
-        try:
-            cmd += " -n " + descr.find(ns + "ReservationIdentification").find(ns + "ReservationName").text
-        except:
-            pass
- 
-        if os.getenv("QCG_AR_MAUI_PARTITION") != None:
-	    cmd += " -p " +  os.getenv("QCG_AR_MAUI_PARTITION") + " "
+    
     
         slotsCount = 1
@@ -237,5 +223,5 @@
             command = cmd + " TASKS==" + str(slots)
 
-            info("cmd = " + command)
+            debug("cmd = " + command)
 
             output = getstatusoutput(command)
Index: trunk/src/modules/python/reservation_sge/reservation_sge.py
===================================================================
--- trunk/src/modules/python/reservation_sge/reservation_sge.py	(revision 304)
+++ trunk/src/modules/python/reservation_sge/reservation_sge.py	(revision 1)
@@ -3,24 +3,15 @@
 # vim: set ts=4 sw=4 et:
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
-
-from qcg.core import *
-from qcg.comp import *
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 try:
@@ -48,5 +39,7 @@
 from commands import getstatusoutput
 import re
-import os
+from qcg.core import *
+from qcg.comp import *
+
 ns = "{" + SMC_NAMESPACE_ARDL + "}"
 
@@ -219,16 +212,10 @@
 	    command = "qrsub"
 	    parEnv = "make"
-	    if os.getenv("QCG_GE_PE_NAME") != None:
-	    	parEnv = os.getenv("QCG_GE_PE_NAME")
-
-	    if os.getenv("QCG_GE_AR_QUEUE") != None:
-	    	command += " -q " + os.getenv("QCG_GE_AR_QUEUE")
-
-
+           
 	    if slots != "1":
                 command += " -pe " + parEnv + " " + str(slots) + " "
 
             command += cmd
-            info("cmd = " + command)
+            debug("cmd = " + command)
 
             output = getstatusoutput(command)
Index: trunk/src/modules/python/wrappers/reservation_python/reservation_python.c
===================================================================
--- trunk/src/modules/python/wrappers/reservation_python/reservation_python.c	(revision 395)
+++ trunk/src/modules/python/wrappers/reservation_python/reservation_python.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <sys/types.h>
@@ -37,5 +30,4 @@
 
 #include <include/reservation_module.h>
-#include <include/namespaces.h>
 
 __SM_ID("$Id: reservation_python.c 2 2009-10-05 10:09:52Z mamonski $");
@@ -156,6 +148,4 @@
 		goto fault;
 	}
-	
-	smc_extensions_add(SMC_NAMESPACE_EXT_ADVANCE_RESERVATION);
 
 	SM_FREE(config_xml);
Index: trunk/src/modules/python/monitoring/Makefile.am
===================================================================
--- trunk/src/modules/python/monitoring/Makefile.am	(revision 658)
+++ trunk/src/modules/python/monitoring/Makefile.am	(revision 1)
@@ -5,4 +5,5 @@
     grid_monitoring/core.py \
     grid_monitoring/miscutil.py \
+    grid_monitoring/example.py \
     grid_monitoring/__init__.py \
     grid_monitoring/sgeimpl.py \
@@ -10,7 +11,5 @@
     grid_monitoring/gmexceptions.py \
     grid_monitoring/lsfimpl.py \
-    grid_monitoring/pbsimpl.py \
-    grid_monitoring/slurmimpl.py \
-    grid_monitoring/llimpl.py
+    grid_monitoring/pbsimpl.py
 
 if HAVE_PYTHON
@@ -23,4 +22,5 @@
     grid_monitoring/core.py \
     grid_monitoring/miscutil.py \
+    grid_monitoring/example.py \
     grid_monitoring/__init__.py \
     grid_monitoring/sgeimpl.py \
@@ -28,7 +28,5 @@
     grid_monitoring/gmexceptions.py \
     grid_monitoring/lsfimpl.py \
-    grid_monitoring/pbsimpl.py \
-    grid_monitoring/slurmimpl.py \
-    grid_monitoring/llimpl.py
+    grid_monitoring/pbsimpl.py
 
 endif
Index: trunk/src/modules/python/monitoring/test-monitoring.py
===================================================================
--- trunk/src/modules/python/monitoring/test-monitoring.py	(revision 648)
+++ trunk/src/modules/python/monitoring/test-monitoring.py	(revision 1)
@@ -1,34 +1,207 @@
-from monitoring import *
-from grid_monitoring.common import asDict,asList
-
-#drms_type="http://schemas.qoscosgrid.org/comp/2011/04/drms/PBSPro/PBS-Professional"
-drms_type="http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque"
-#drms_type="http://schemas.qoscosgrid.org/comp/2011/04/drms/SLURM/"
-
-
-#contained resources handler
-
-hostsInfo = grid_monitoring.getHostData(drms_type)
-doc = containedResourcesFromHostInfos(hostsInfo)
-#print removeXmlHeader(doc.toxml())
-
-
-
-#factory attr
-queuesInfo = grid_monitoring.getQueueData(drms_type)
-reservationsInfo = grid_monitoring.getReservationData(drms_type)
-jobsInfos = grid_monitoring.getJobData(drms_type)
-doc = clusterMonitoringFromQueuesResAndJobs(queuesInfo, reservationsInfo, jobsInfos)
-#print removeXmlHeader(doc.toxml())
-
-
-grid_monitoring.addExtendedJobData(drms_type, asDict(jobsInfos).keys(), asDict(jobsInfos).keys())
-
-for jobId, jobInfo in asDict(jobsInfos).iteritems():
-    try:
-        doc = jobMonitoringXmlFromJobInfo(jobInfo)
-        print jobId + " : " + removeXmlHeader(doc.toxml())
-        doc.unlink()
-    except:
-        raise
-
+try:
+    import grid_monitoring
+except ImportError:
+    error("Unable to load grid_monitoring module")
+    raise
+
+from xml.dom.minidom import Document
+import datetime
+
+__MonitoringNSPrefix = "monitoring"
+__MonitoringNS = "http://schemas.qoscosgrid.org/comp/2011/04/monitoring"
+__BesFactoryNSPrefix = "bes-factory"
+__BesFactoryNS = "http://schemas.ggf.org/bes/2006/08/bes-factory"
+__JsdlNSPrefix = "jsdl"
+__JsdlNS = "http://schemas.ggf.org/jsdl/2005/11/jsdl"
+
+def __toXmlDuration(td):
+    xmlPeriod = "PT"
+    hours = td.days * 24
+    hoursA = td.seconds / 3600
+    hours = hours + hoursA
+    sec = td.seconds - hoursA * 3600
+    minutes = sec / 60
+    sec = sec - minutes * 60
+    xmlPeriod = xmlPeriod + str(hours) + "H" + str(minutes) + "M" + str(sec) + "S"
+    return xmlPeriod
+
+def __toXmlDateTime(dt):
+    return dt.replace(microsecond=0).isoformat()
+
+def jobMonitoringXmlFromJobInfo(jobInfo):    
+    """Gets XML from JobInfo entity"""
+    doc = Document()        
+    jobMonitoring = doc.createElementNS(__MonitoringNS, "JobMonitoring")        
+    jobMonitoring.setAttribute("xmlns", __MonitoringNS)
+    doc.appendChild(jobMonitoring)
+    executionHosts = doc.createElement("ExecutionHosts")
+    jobMonitoring.appendChild(executionHosts)
+    for hostTuple in jobInfo.ExecutionHosts:
+        host = doc.createElement("Host")            
+        host.setAttribute("name", hostTuple[0])
+        host.setAttribute("slots", str(hostTuple[1]))
+        executionHosts.appendChild(host)
+        
+    cpuTimeUsage = doc.createElement("CPUTimeUsage")
+        
+    time = jobInfo.UserTime
+    hours = time/3600
+    time = time - hours*3600
+    minutes = time/60
+    time = time - minutes*60
+    seconds = time
+    userTime = datetime.timedelta(hours=hours, minutes=minutes, seconds=seconds)
+    cpuTimeText = doc.createTextNode(str(userTime))        
+        
+    cpuTimeUsage.appendChild(cpuTimeText)
+    jobMonitoring.appendChild(cpuTimeUsage)
+        
+    memUsage = doc.createElement("MemUsage")
+    memUsageText = doc.createTextNode(str(jobInfo.TotalMem))
+    memUsage.appendChild(memUsageText)
+    jobMonitoring.appendChild(memUsage)
+            
+    return doc
+
+def containedResourcesFromHostInfos(hostsInfo):
+    """Gets XML from list of HostInfo entities"""
+    
+   
+    doc = Document()
+
+    cluster = doc.createElementNS(__BesFactoryNS, "ContainedResources")    
+    cluster.setAttribute("xmlns:" + __BesFactoryNSPrefix, __BesFactoryNS)
+    cluster.setAttribute("xmlns:" + __JsdlNSPrefix, __JsdlNS)
+    doc.appendChild(cluster)        
+    
+    for host in hostsInfo:
+        containedResource = doc.createElement("ContainedResource")
+        cluster.appendChild(containedResource)
+        
+        resourceName = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":ResourceName")
+        containedResource.appendChild(resourceName)
+        text = doc.createTextNode(str(host.HostName))
+        resourceName.appendChild(text)
+        
+        if not host.CpuArch == "Unknown":                         
+            cpuArchitecture = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":CPUArchitecture")
+            containedResource.appendChild(cpuArchitecture)
+            cpuArchitectureName = doc.createElementNS(__JsdlNS, __JsdlNSPrefix + ":CPUArchitectureName")
+            cpuArchitecture.appendChild(cpuArchitectureName)
+            text = doc.createTextNode(str(host.CpuArch))
+            cpuArchitectureName.appendChild(text)
+        
+        cpuCount = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":CPUCount")
+        containedResource.appendChild(cpuCount)
+        text = doc.createTextNode(str(int(host.CpuCount)))
+        cpuCount.appendChild(text)
+
+        if(host.TotalMemory == None):
+            raise ValueError("TotalMemory cannot be None")
+        physicalMemory = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":PhysicalMemory")
+        containedResource.appendChild(physicalMemory)
+        text = doc.createTextNode(str(int(host.TotalMemory)))
+        physicalMemory.appendChild(text)
+        
+        if(host.TotalSwap == None):
+            raise ValueError("TotalSwap cannot be None")
+        virtualMemory = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":VirtualMemory")
+        containedResource.appendChild(virtualMemory)
+        text = doc.createTextNode(str(int(host.TotalSwap)))
+        virtualMemory.appendChild(text)
+        
+        if(host.CpuUtilization == None):
+            raise ValueError("CpuUtilization cannot be None")
+        utilization = doc.createElementNS(__MonitoringNS, "Utilization")
+        containedResource.appendChild(utilization)
+        utilization.setAttribute("xmlns", __MonitoringNS)
+        text = doc.createTextNode(str(int(host.CpuUtilization * 100)))
+        utilization.appendChild(text)
+        
+    return doc
+
+def clusterMonitoringFromQueuesAndRes(queuesInfo, reservationsInfo):
+    """Gets XML from list of QueueInfo and ReservationInfo entities"""
+    
+#    for queue in queuesInfo:
+#        if not isinstance(queue, grid_monitoring.QueueInfo):
+#            raise TypeError("queuesInfo must contain only QueueInfo instances")
+        
+#    for reservation in reservationsInfo:
+#        if not isinstance(reservation, grid_monitoring.ReservationInfo):
+#            raise TypeError("reservationsInfo must contain only ReservationInfo instances")
+        
+    doc = Document()
+    
+    cluster = doc.createElementNS(__MonitoringNS, "ClusterMonitoring")    
+    cluster.setAttribute("xmlns", __MonitoringNS)
+    doc.appendChild(cluster)
+    
+    queues = doc.createElementNS(__MonitoringNS, "Queues")
+    cluster.appendChild(queues)
+    
+    for queueInfo in queuesInfo:
+        queue = doc.createElementNS(__MonitoringNS, "Queue")
+        queue.setAttribute("name", queueInfo.QueueName)
+        if queueInfo.Walltime == None:
+            raise ValueError("Walltime must not be None")
+        queue.setAttribute("walltime", __toXmlDuration(queueInfo.Walltime))
+        queue.setAttribute("default", str(queueInfo.IsDefault))
+        queue.setAttribute("priority", str(queueInfo.QueuePriority))
+        queue.setAttribute("maxJobs", str(queueInfo.MaxJobs))
+        queue.setAttribute("runningJobs", str(queueInfo.RunningJobs))
+        queue.setAttribute("waitingJobs", str(queueInfo.PendingJobs))
+        queues.appendChild(queue) 
+    
+    reservations = doc.createElementNS(__MonitoringNS, "Reservations")
+    cluster.appendChild(reservations)
+    
+    for reservationInfo in reservationsInfo:
+        
+        reservation = doc.createElementNS(__MonitoringNS, "Reservation")
+        reservation.setAttribute("name", reservationInfo.ReservationName)
+        reservation.setAttribute("type", reservationInfo.Type)
+        if reservationInfo.StartTime == None:
+            raise ValueError("StartTime must not be None")
+        reservation.setAttribute("startTime", __toXmlDateTime(reservationInfo.StartTime))
+        if reservationInfo.EndTime != None:
+            reservation.setAttribute("EndTime", __toXmlDateTime(reservationInfo.EndTime))
+        reservation.setAttribute("owner", reservationInfo.Owner)
+        reservations.appendChild(reservation)
+        
+        resources = reservationInfo.Resources
+        for resourceKey in resources.keys():
+            resource = doc.createElementNS(__MonitoringNS, "Resource")
+            resource.setAttribute("name", resourceKey)
+            resource.setAttribute("reservedSlots", str(resources[resourceKey]))
+            reservation.appendChild(resource)
+        
+    return doc
+
+def removeXmlHeader(string):
+    return string.replace("<?xml version=\"1.0\" ?>", "")
+
+
+_cap_map = grid_monitoring.monitoringCapabilities()
+
+def factory_attr_handler(drms_type):
+    queuesInfo = grid_monitoring.getQueueData(drms_type, None)
+    reservationsInfo = grid_monitoring.getReservationData(drms_type, None)
+    doc = clusterMonitoringFromQueuesAndRes(queuesInfo, reservationsInfo)                
+    return removeXmlHeader(doc.toprettyxml()) 
+        
+def contained_resources_handler(drms_type):
+    hostsInfo = grid_monitoring.getHostData(drms_type, None)
+    doc = containedResourcesFromHostInfos(hostsInfo)                  
+    return removeXmlHeader(doc.toprettyxml())
+                            
+def job_info_handler(drms_type, job_id):
+    jobInfo = grid_monitoring.getJobData(drms_type, [job_id])[0]
+    doc = jobMonitoringXmlFromJobInfo(jobInfo)
+    return removeXmlHeader(doc.toxml())           
+
+print contained_resources_handler("http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque")
+print job_info_handler("http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque", '110651.grass1.man.poznan.pl')
+#print job_info_handler("http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque", '26490-1.grass1')
+#print job_info_handler("http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque", '26490-2.grass1.man.poznan.pl')
+#print factory_attr_handler('http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque')
Index: trunk/src/modules/python/monitoring/grid_monitoring/example.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/example.py	(revision 1)
+++ trunk/src/modules/python/monitoring/grid_monitoring/example.py	(revision 1)
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+from TorqueImpl import getHostData, getJobData, getQueueData
+
+#get all hosts
+hosts = getHostData(None)
+
+queue_set = set()
+job_set = set()
+
+print """
+------------------
+HOSTS INFORMATION
+------------------
+"""
+
+#for host in hosts:
+#	host.printData()
+#	print "----------"
+	#get jobs running on hosts
+#	for job in host.jobs:
+#		job_set.add(job)
+	#get hosts queues
+#	for queue in host.queues:
+#		queue_set.add(queue)
+
+
+# get data about running jobs and queues
+#jobs = getJobData(job_set)
+#queues = getQueueData(queue_set)
+
+print """
+------------------
+QUEUES INFORMATION
+------------------
+"""
+
+#for queue in queues:
+#	queue.printData()
+#	print "----------"
+
+print """
+------------------
+JOBS INFORMATION
+------------------
+"""
+
+#for job in jobs:
+#	job.printData()
+#	print "----------"
Index: trunk/src/modules/python/monitoring/grid_monitoring/sgeimpl.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/sgeimpl.py	(revision 656)
+++ trunk/src/modules/python/monitoring/grid_monitoring/sgeimpl.py	(revision 1)
@@ -1,21 +1,16 @@
+#!/usr/bin/env python
 # $Id$
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 import os
Index: trunk/src/modules/python/monitoring/grid_monitoring/torqueimpl.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/torqueimpl.py	(revision 1109)
+++ trunk/src/modules/python/monitoring/grid_monitoring/torqueimpl.py	(revision 1)
@@ -1,65 +1,37 @@
+#!/usr/bin/env python
 
 # $Id$
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
-
-try:
-    from qcg.core import *
-except ImportError:
-    def error(msg):
-        print >> sys.stderr, "[ERROR] " + msg
-    pass #for testing only
-
-import datetime, sys, subprocess, re, traceback, time, os
-from common import HostInfo, QueueInfo, JobInfo, ReservationInfo, asList, asDict
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+import datetime, sys, subprocess, re, traceback, time
+from common import HostInfo, QueueInfo, JobInfo, ReservationInfo
 from gmexceptions import GMInternalError, GMExternalError, GMUnknowJob
-try:
-    import libxml2 
-except ImportError:
-    error("Unable to load libxml2. No reservation info woulbe be returned")
-
-
-__jobsRegex = re.compile(r'[, \d]+/([^,]*)(.*)')
-#__statusRegex = re.compile(r'([^=]+)=([^,]*),*')
-__statusRegex = re.compile(r'([^=]+)=(.*?)($|(,(?=[a-zA-Z_0-9]+?=)))')
+import libxml2 #@UnresolvedImport
+
+__jobsRegex = re.compile(r'(.*)/(.*)')
+__statusRegex = re.compile(r'([^=]+)=([^,]*),*')
 __queueStateRegex = re.compile(r'([^:]+):([^ ]*)[ ]*')
 __execHostRegex = re.compile(r'([^/]+)/\d+\+*')
-__nodesRegex = re.compile(r'(\d+)(:ppn=(\d+))?[^+]*\+?')
 __valueRegex = re.compile(r'([\d\.]+)(\D*)')
 __walltimeRegex = re.compile(r'([0-9]+):([0-9]+):([0-9]+)')
 __resACLRegex = re.compile(r'^\s*ACL:.*USER==(\w+)', re.MULTILINE)
-__resIdRegex = re.compile(r'FLAGS:ADVRES:(\S+)', re.MULTILINE)
 __resAccountingRegex = re.compile(r'^\s*Accounting.*User:(\w+)', re.MULTILINE)
 __newlineRegex = re.compile(r'\n')
 __emptyLineRegex = re.compile(r'\n[\s\n]*\n')
 __equalRegex = re.compile(r'[ ]+=[ ]+')
-__jobIdRegex = re.compile(r'[^\d]*(\d+.*)')
+__jobIdRegex = re.compile(r'[^\d]*([\d\-]+).*')
 __queueRegex = re.compile(r'Queue: (.+)')
-__showstartRegex = re.compile(r'^[\w\s]+start in\s+(([0-9]+):)?([0-9]+):([0-9]+):([0-9]+)', re.MULTILINE) # 13:02:08:33 or 00:00:00
-__showstartInfRegex = re.compile(r'^[\w\s]+start in\s+INFINITY', re.MULTILINE) # 13:02:08:33 or 00:00:00
-__hostsInfoDict = None
-__hostsInfoList = None
-__jobsInfoDict = None
-__jobsInfoList = None
-__queuesInfoList = None
-__queuesInfoDict = None
-__reservationsInfoDict = None
-__reservationsInfoList = None
 
 def __checknodeResRegexExp(value):
@@ -71,5 +43,4 @@
 __postfixTable = {
     "": 1,
-    "b": 1,
     "kb": 1024,
     "mb": 1024*1024,
@@ -87,18 +58,7 @@
 
 def __calculateValue(value):
-    try:
-      p = __extractPostFix(value)
-      return float(round(float(p[0]) \
+    p = __extractPostFix(value)
+    return float(round(float(p[0]) \
         *__postfixTable.get(p[1]))) 
-    except Exception:
-      return float(0)
-
-
-def __parseFloatValue(value):
-    try:
-      return float(value)
-    except Exception:
-      return float(0)
-
 
 def __commandOutputToDict(output, items_list=None, key_regex=None):
@@ -110,8 +70,8 @@
         block_lines = __newlineRegex.split(block)
 
-        if key_regex != None:
-          block_name = key_regex.match(block_lines[0]).group(1)
-        else:
-          block_name = block_lines[0]
+	if key_regex != None:
+	    block_name = key_regex.match(block_lines[0]).group(1)
+	else:
+            block_name = block_lines[0]
 
         block_lines = block_lines[1:]
@@ -119,37 +79,18 @@
         for line in block_lines:
             tuple = __equalRegex.split(line, 1)
-            if len(tuple) == 2:
-              block_dict[ tuple[0].strip() ] = tuple[1].strip()
+            block_dict[ tuple[0].strip() ] = tuple[1].strip()
 
         if items_list != None:
-          items_list.append(block_name)
+        	items_list.append(block_name)
 
         items_dictionary[block_name] = block_dict
-
+     
     return items_dictionary
 
-def getHostData():
-    global __hostsInfoDict
-    global __hostsInfoList
-    if __hostsInfoList is not None:
-        return (__hostsInfoList, __hostsInfoDict)
-
-    __hostsInfoDict = dict()
-    __hostsInfoList = []
-    pbsnodes_output = _pbsnodes(['-a'] )
-    nodes_filter = os.getenv("QCG_NODE_FILTER")
-    if nodes_filter != None:
-        try:
-            nodes_filter_key = nodes_filter.split(":")[0]
-            nodes_filter_regex_str = nodes_filter.split(":")[1]
-            if nodes_filter_regex_str[:1] == '~':
-                nodes_filter_negative = True
-                nodes_filter_regex_str = nodes_filter_regex_str[1:]
-            else:
-                nodes_filter_negative = False
-            nodes_filter_regex = re.compile(nodes_filter_regex_str)
-        except Exception:
-            raise GMInternalError("QCG_NODE_FILTER: Invalid format: '" + nodes_filter + "':. Expected: 'field:regex'")
-
+def getHostData(hostnames=None):
+    
+    hostsInfo = []
+    pbsnodes_output = _pbsnodes(['-a'])
+    
     pbsnodes_nodes_list = __emptyLineRegex.split(pbsnodes_output)
     nodes_list = []
@@ -160,15 +101,6 @@
         current_host.HostName = node_name;
         node_properties = nodes_dictionary[node_name];
-        if nodes_filter != None:
-            if nodes_filter_key not in node_properties:
-                current_host.Dedicated = True
-            if (nodes_filter_regex.search(node_properties[nodes_filter_key]) == None) ^ nodes_filter_negative:
-                current_host.Dedicated = True
-        if node_properties['state'].find("down") != -1: 
-          current_host.State = "down"
-        elif node_properties['state'].find("offline") != -1:
-          current_host.State = "offline"
-        else:
-          current_host.State = "up"
+        if node_properties['state'] != "free" and node_properties['state'] != "job-exclusive":
+            continue 
         current_host.CpuCount = int(node_properties['np'])
 
@@ -176,57 +108,36 @@
         if 'jobs' in node_properties:
             m = __jobsRegex.match(node_properties['jobs'])
-            current_host.Jobs = []
             while m!=None:
-              current_host.Jobs.append(m.group(1))
-              jobs = m.group(2)
-              m = __jobsRegex.match(jobs)
-
-            current_host.UsedCpuCount = len(current_host.Jobs)
-
-        if 'properties' in node_properties:
-          current_host.AdditionalResources = node_properties['properties']
-
-        if 'status' in node_properties:
-          #decode status
-          attributes = __decodeHostStatusField(node_properties['status'])
-
-          if attributes.get('opsys') != None:
-            current_host.OSName = attributes["opsys"]
-
-          if attributes.get('uname') != None:
-            uname = attributes["uname"]
-            if uname.find("x86_64") != -1:
-              current_host.CpuArch = "x86_64"
-            elif uname.find("x86") != -1:
-              current_host.CpuArch = "x86"
-            elif uname.find("IA-64") != -1:
-              current_host.CpuArch = "IA-64"
-
-          if current_host.CpuArch == "Unknown" and properties != None:
-            if properties.find("x86_64") != -1:
-              current_host.CpuArch = "x86_64"
-            elif properties.find("x86") != -1:
-              current_host.CpuArch = "x86"
-            elif properties.find("IA-64") != -1:
-              current_host.CpuArch = "IA-64"
-
-          if attributes.get('physmem') != None:
-            current_host.TotalMemory = __calculateValue(attributes["physmem"])
-
-          if attributes.get('totmem') != None:
-            current_host.TotalSwap = __calculateValue(attributes["totmem"]) - current_host.TotalMemory
-
-          if attributes.get('loadave') != None:
-              current_host.CpuUtilization = __parseFloatValue((attributes["loadave"]))
-
-        if 'gpus' in node_properties:
-            gpus = int(node_properties['gpus'])
-            if gpus > 0:
-                current_host.GpuCount = gpus
-
-        __hostsInfoDict[node_name]=current_host
-        __hostsInfoList.append(current_host)
-
-    return (__hostsInfoList,__hostsInfoDict)
+                current_host.Jobs.append(m.group(1))
+                jobs = m.group(2)
+                m = __jobsRegex.match(jobs)
+
+        #decode status
+        attributes = __decodeHostStatusField(node_properties['status'])
+	current_host.OSName = attributes["opsys"]
+	uname = attributes["uname"]
+	if uname.find("x86_64") != -1:
+	    current_host.CpuArch = "x86_64"
+	elif uname.find("x86") != -1:
+	    current_host.CpuArch = "x86"
+	elif uname.find("IA-64") != -1:
+	    current_host.CpuArch = "IA-64"
+
+	if current_host.CpuArch == "Unknown" and properties != None:
+	    if properties.find("x86_64") != -1:
+	        current_host.CpuArch = "x86_64"
+	    elif properties.find("x86") != -1:
+	        current_host.CpuArch = "x86"
+	    elif properties.find("IA-64") != -1:
+	        current_host.CpuArch = "IA-64"
+
+	current_host.CpuCount = int(attributes["ncpus"])
+	current_host.TotalMemory = __calculateValue(attributes["physmem"])
+	current_host.TotalSwap = __calculateValue(attributes["totmem"]) - current_host.TotalMemory
+	current_host.CpuUtilization = float(attributes["loadave"])
+
+        hostsInfo.append(current_host)
+
+    return hostsInfo
 
 def __decodeHostStatusField(status):
@@ -246,35 +157,4 @@
     sec = int(match.group(1)) * 3600 + int(match.group(2)) * 60 + int(match.group(3))
     return datetime.timedelta(seconds=sec) 
-
-def __decodeNodes(nodes):
-    totalCores = 0
-    try:
-        for m in __nodesRegex.finditer(nodes):
-            if m.group(3) is not None:
-                totalCores = totalCores + int(m.group(3)) * int(m.group(1)) #nodes + ppn
-            else:
-                totalCores = totalCores + int(m.group(1)) #only nodes
-        
-        if totalCores != 0:
-            return totalCores
-        else:
-            return None
-    except:
-        error("Failed to parse: nodes: " + nodes)
-        return None
-
-def __decodeShowstartTimeDelta(time):
-    match = __showstartRegex.search(time)
-    if match is None:
-        if __showstartInfRegex.search(time) is None:
-            error("failed to match showstart output: " + time)
-        else:
-            return datetime.timedelta(days=1024) #1024 days = infinity
-        return None
-    
-    sec = int(match.group(3)) * 3600 + int(match.group(4)) * 60 + int(match.group(5))
-    if match.group(2) is not None:
-        sec += int(match.group(2)) * 3600 * 24
-    return datetime.timedelta(seconds=sec)
         
 def __decodeHostData(info):
@@ -310,5 +190,5 @@
             current_host.CpuArch = "IA-64"
     
-    current_host.CpuCount = int(info[1]["np"])
+    current_host.CpuCount = int(attributes["ncpus"])    
     current_host.TotalMemory = __calculateValue(attributes["physmem"])
     current_host.TotalSwap = __calculateValue(attributes["totmem"]) - current_host.TotalMemory
@@ -323,50 +203,24 @@
     return current_host
 
-def getJobData():
-    global __jobsInfoList
-    global __jobsInfoDict
-    
-    if __jobsInfoList is not None:
-        return (__jobsInfoList,__jobsInfoDict)
-
-    __jobsInfoDict = dict()
-    __jobsInfoList = []
-    qstat_output = _qstat(['-f', '-1'])
-    job_list = __commandOutputToDict(qstat_output, None, __jobIdRegex)
-    for jobid,job_info in job_list.iteritems():
-        job = __decodeJobData(jobid, job_info)
-        if job != None:
-            __jobsInfoDict[jobid] = job
-            __jobsInfoList.append(job)
-
-
-    return (__jobsInfoList,__jobsInfoDict)
-
-def addExtendedJobData(job_ids, all_job_ids):
-    jobInfos = asDict(getJobData())
-    for job_id in job_ids:
-        if job_id not in jobInfos:
-            continue
-        jobInfo = jobInfos[job_id]
-        if jobInfo.JobStatus == "Pending" and jobInfo.EstStartTime is None:
-            showstart_output = _showstart([jobInfo.JobID])
-            if showstart_output is None:
-                continue
-            est_start_delta = __decodeShowstartTimeDelta(showstart_output)
-            if est_start_delta is not None:
-                jobInfo.EstStartTime = datetime.datetime.now() + est_start_delta
-
-
-
+def getJobData(jobids=None):
+    jobsInfo = []
+    if jobids != None:
+        for jobid in jobids:        
+            jobid = __jobIdRegex.match(jobid).group(1)
+            qstat_output = _qstat(['-f', '-1', jobid])
+            job_info = __commandOutputToDict(qstat_output, None, __jobIdRegex)[jobid]
+            jobsInfo.append(__decodeJobData(jobid, job_info))   
+    else:
+        qstat_output = _qstat(['-f', '-1'])
+        job_list = __commandOutputToDict(qstat_output, None, __jobIdRegex)
+        for jobid,job_info in job_list.iteritems():
+            jobsInfo.append(__decodeJobData(jobid, job_info))
+
+    return jobsInfo
 
 def __decodeJobData(jobid, attributes):
     current_job = JobInfo()
     current_job.JobID = jobid
-    #guard agains weired output
-    if "Job_Name" not in attributes:
-      return None
-
     current_job.JobName = attributes["Job_Name"]
-
     if attributes["job_state"] == "R" or attributes["job_state"] == "E":
         current_job.JobStatus = "Running"
@@ -374,8 +228,8 @@
         current_job.JobStatus = "Pending"
     elif attributes["job_state"] == "C":
-        current_job.JobStatus = "Done"
+        current_job.JobStatus = "Finished"
     else:
         current_job.JobStatus = "Unknown"
-    current_job.OwnerName = attributes["Job_Owner"].split("@")[0]
+    current_job.OwnerName = attributes["Job_Owner"]
     current_job.QueueName = attributes["queue"]
     current_job.SubmissionTime = datetime.datetime(*time.strptime(attributes["qtime"])[:6])
@@ -393,55 +247,25 @@
                 hosts[host_name]  = 1 
 
-    if "resources_used.cput" in attributes:
-      current_job.CpuTime = __decodeTimeDelta(attributes["resources_used.cput"])
-    if "resources_used.walltime" in attributes:
-      current_job.Walltime = __decodeTimeDelta(attributes["resources_used.walltime"])
-    if "resources_used.mem" in attributes:
-      current_job.MemUsage = long(__calculateValue(attributes["resources_used.mem"]) / (1024*1024)) #MemUsage is in Megabytes
-
-    if "Resource_List.nodes" in attributes:
-      current_job.TotalCores = __decodeNodes(attributes["Resource_List.nodes"])
-    elif "Resource_List.procs" in attributes:
-      current_job.TotalCores = int(attributes["Resource_List.procs"])
- 
-    if "submit_args" in attributes:
-      current_job.Description = attributes["submit_args"]
-
-    if ("submit_args" in attributes) and (attributes["submit_args"].find("FLAGS:ADVRES:") != -1):
-      current_job.ReservationID =  __resIdRegex.search(attributes["submit_args"]).group(1)
-    
-    if ("x" in attributes) and (attributes["x"].find("FLAGS:ADVRES:") != -1):
-      current_job.ReservationID =  __resIdRegex.search(attributes["x"]).group(1)
-
     for host,slots in hosts.iteritems():
-        current_job.ExecutionHosts[host] = slots
-        if host in getHostData()[1] and getHostData()[1][host].State == "down":
-            current_job.addComment("One of the job execution host (" + host + ") is down")
-    #extra checks
-    if current_job.JobStatus == "Pending" and \
-       current_job.QueueName in getQueueData()[1] and \
-       getQueueData()[1][current_job.QueueName].Started == False:
-        current_job.addComment("Queue " + current_job.QueueName + " is not started")
+        current_job.ExecutionHosts.append((host,slots))
 
     return current_job
     
     
-def getQueueData():
-    global __queuesInfoList
-    global __queuesInfoDict
-    if __queuesInfoList is not None:
-       return (__queuesInfoList, __queuesInfoDict)
-
-    qstat_output = _qstat([ '-f', '-Q', '-1'])
+def getQueueData(queuenames=None):
+   
+    #TODO try to obtain default queue name
+    default_queue = None
+    qstat_output = _qstat([ '-f', '-Q'])
     all_queues = __commandOutputToDict(qstat_output, None, __queueRegex)
 
-    __queuesInfoDict = dict() 
-    __queuesInfoList = []
+    queuesInfo = [] 
     for queue_name, queue_dict in all_queues.iteritems():
             decodedQueue = __decodeQueueData(queue_name, queue_dict) 
-            __queuesInfoDict[queue_name] = decodedQueue   
-            __queuesInfoList.append(decodedQueue)   
-
-    return (__queuesInfoList,__queuesInfoDict)
+            if decodedQueue.QueueName == default_queue:
+                decodedQueue.IsDefault = True
+            queuesInfo.append(decodedQueue)     
+
+    return queuesInfo
 
 def __decodeQueueData(queue_name, attributes):
@@ -451,6 +275,4 @@
     current_queue.PendingJobs = int(queue_state["Queued"])  
     current_queue.RunningJobs = int(queue_state["Running"])
-    current_queue.Enabled = (attributes["enabled"] == "True")
-    current_queue.Started = (attributes["started"] == "True")
     if "resources_default.walltime" in attributes.keys():
         current_queue.Walltime = __decodeTimeDelta(attributes["resources_default.walltime"])
@@ -459,4 +281,8 @@
     current_queue.job_slots_aval = 0
     current_queue.job_slots_total = 0
+    if attributes["enabled"] == "True":
+        current_queue.QueueEnabled = True
+    else:
+        current_queue.QueueEnabled = False  
     return current_queue
 
@@ -466,6 +292,6 @@
         command.extend(args)
         sr = subprocess.Popen(command, stdout=subprocess.PIPE)
-    except OSError, e:
-        raise GMExternalError("qstat command failed, reason:\n" + str(e))        
+    except OSError:
+        raise GMExternalError("qstat command failed, reason:\n" + traceback.format_exc())        
     
     qstat_output = sr.communicate()[0]
@@ -483,10 +309,10 @@
         command.extend(args)
         sr = subprocess.Popen(command, stdout=subprocess.PIPE)
-    except OSError, e:
-        raise GMExternalError("pbsnodes command failed, reason:\n" + str(e))        
+    except OSError:
+        raise GMExternalError("pbsnodes command failed, reason:\n" + traceback.format_exc())        
     
     pbsnodes_output = sr.communicate()[0]
     if sr.returncode != 0:
-        raise GMExternalError("pbsnodes command returned code: " + str(sr.returncode) + ". Details: " + pbsnodes_output)
+        raise GMExternalError("pbsnodes command returned code: " + str(sr.returncode))
     return pbsnodes_output
 
@@ -497,6 +323,5 @@
         sr = subprocess.Popen(command, stdout=subprocess.PIPE)
     except OSError:
-      # return dummy answer
-      return "<response><data><sys time='1334223891'></sys></data><status code='0'>success</status></response>"
+        raise GMExternalError("showres command failed, reason:\n" + traceback.format_exc())     
     
     showres_output = sr.communicate()[0]
@@ -504,21 +329,4 @@
         raise GMExternalError("showres command returned code: " + str(sr.returncode))
     return showres_output
-
-def _showstart(args):
-    try:
-        command = ['showstart']
-        command.extend(args)
-        sr = subprocess.Popen(command, stdout=subprocess.PIPE)
-    except OSError:
-        error("showstart command failed, reason:\n" + traceback.format_exc())
-        return None
-    
-    showstart_output = sr.communicate()[0]
-    if sr.returncode != 0:
-        error("showstart command returned code: " + str(sr.returncode))
-        return None
-
-    return showstart_output
-
 
 def _checknode(args):
@@ -548,24 +356,20 @@
     return diagnose_output
 
-def getReservationData():
-    global __reservationsInfoList
-    global __reservationsInfoDict
-    if __reservationsInfoList is not None:
-        return (__reservationsInfoList, __reservationsInfoDict)
-    __reservationsInfoList = []
-    __reservationsInfoDict = dict()
+def getReservationData(reservation_names=None):
+    reservations_info = []
     showres_output = _showres(['-n', '--format=xml'])
-    showres_output = showres_output.replace("Response>","response>").replace("Data>","data>")
     doc = libxml2.parseDoc(showres_output)
     ctx = doc.xpathNewContext()
     status_code = ctx.xpathEval("/response/status/@code")
-    if len(status_code) == 1 and status_code[0].content != "0":
+    if len(status_code) != 1:
+        raise GMInternalError("showres output is weird. Expected 1 status code attribute.")
+    if status_code[0].content != "0":
         raise GMInternalError("showres status code was: " + status_code[0].content)
     reservation_doc = ctx.xpathEval("/response/data/node")
-    if len(reservation_doc) == 0:
-       reservation_doc = ctx.xpathEval("/data/node") #Moab
-    
+    
+    reservations = {}
     
     for node in reservation_doc:        
+        print node
         ctx.setContextNode(node)
         host_name = ctx.xpathEval("@name")[0].content
@@ -573,4 +377,6 @@
         ctx.setContextNode(nres)
         res_name = ctx.xpathEval("@Name")[0].content        
+        if(reservation_names != None and res_name not in reservation_names):
+            continue
         
         res_type = ctx.xpathEval("@Type")[0].content
@@ -584,29 +390,55 @@
             raise GMInternalError("Reservation type: " + res_type + " is unknown")
 
-        res_tc = int(ctx.xpathEval("@TC")[0].content)
+        print "res_name = " + res_name
  
-        if(res_name not in __reservationsInfoDict):            
-            __reservationsInfoDict[res_name] = ReservationInfo()
-            __reservationsInfoDict[res_name].ReservationName = res_name                   
-            __reservationsInfoList.append(__reservationsInfoDict[res_name])
+        if(res_name not in reservations.keys()):            
+            reservations[res_name] = ReservationInfo()
+            reservations[res_name].ReservationName = res_name                   
         else:
-            __reservationsInfoDict[res_name].Resources[host_name] = res_tc
+            reservations[res_name].Resources[host_name] = 1
             continue
         
-        __reservationsInfoDict[res_name].Resources[host_name] = res_tc
-        __reservationsInfoDict[res_name].Type = resolved_res_type
+        reservations[res_name].Resources[host_name] = 1
+        reservations[res_name].Type = resolved_res_type
         
         start_time = ctx.xpathEval("@Start")[0].content
         end_time = ctx.xpathEval("@End")[0].content
         
-        __reservationsInfoDict[res_name].StartTime = datetime.datetime.fromtimestamp(int(start_time))
-        __reservationsInfoDict[res_name].EndTime = datetime.datetime.fromtimestamp(int(end_time))                     
-
+        reservations[res_name].StartTime = datetime.datetime.fromtimestamp(int(start_time))
+        reservations[res_name].EndTime = datetime.datetime.fromtimestamp(int(end_time))                     
+
+    reservations_info.extend(reservations.values())
     checknode_map = {}
-    
-    #help libmxl with memory mgmt
-    doc.freeDoc()
-    ctx.xpathFreeContext()
-        
-    return (__reservationsInfoList, __reservationsInfoDict)
-
+        
+    return reservations_info
+
+    for reservation in reservations_info:       
+        diagnose_output = _diagnose(['-r', reservation.ReservationName])        
+        aclMatch = __resACLRegex.search(diagnose_output)        
+        if aclMatch != None:
+            reservation.Owner = aclMatch.group(1)
+        else:
+            accMatch = __resAccountingRegex.search(diagnose_output)         
+            if accMatch != None:
+                reservation.Owner = accMatch.group(1)
+            else:
+                reservation.Owner = __defaultOwner
+                
+        for key in reservation.Resources.keys():
+            if key not in checknode_map.keys():             
+                checknode_output = _checknode([key])
+                index = checknode_output.index(__checknodeROI)
+                checknode_output = checknode_output[index+len(__checknodeROI):len(checknode_output)-1]              
+                checknode_map[key] = checknode_output
+            else:
+                checknode_output = checknode_map[key]               
+            
+            regex = __checknodeResRegexExp(reservation.ReservationName)         
+            match = re.findall(regex, checknode_output, re.MULTILINE|re.DOTALL)
+            if len(match) != 1:
+                raise GMInternalError("Could not find matching reservation in checknode output")
+            if len(match[0]) != 2:
+                raise GMInternalError("Could not find matching reservation in checknode output")
+            reservation.Resources[key] = int(match[0][0])       
+    
+    return reservations_info
Index: trunk/src/modules/python/monitoring/grid_monitoring/gmexceptions.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/gmexceptions.py	(revision 304)
+++ trunk/src/modules/python/monitoring/grid_monitoring/gmexceptions.py	(revision 1)
@@ -1,21 +1,15 @@
 # $Id$
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 class GMError(Exception):
Index: trunk/src/modules/python/monitoring/grid_monitoring/lsfimpl.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/lsfimpl.py	(revision 304)
+++ trunk/src/modules/python/monitoring/grid_monitoring/lsfimpl.py	(revision 1)
@@ -1,20 +1,2 @@
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
-
 from lsf import *
 from datetime import datetime
Index: trunk/src/modules/python/monitoring/grid_monitoring/pbsimpl.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/pbsimpl.py	(revision 1109)
+++ trunk/src/modules/python/monitoring/grid_monitoring/pbsimpl.py	(revision 1)
@@ -1,331 +1,104 @@
+#!/usr/bin/env python
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+import pbs
+import re
+from common import HostInfo, QueueInfo, JobInfo
 
-import datetime, sys, subprocess, re, traceback, time, os
-from common import HostInfo, QueueInfo, JobInfo, ReservationInfo, asList, asDict 
-from gmexceptions import GMInternalError, GMExternalError, GMUnknowJob
+JobsRegex = re.compile(r'(.*)/(.*)')
 
-__statusRegex = re.compile(r'([^=]+)=([^,]*),*')
-__queueStateRegex = re.compile(r'([^:]+):([^ ]*)[ ]*')
-__execHostRegex = re.compile(r'([^/]+)/\d+(\*(\d+))?\+*')
-__valueRegex = re.compile(r'([\d\.]+)(\D*)')
-__walltimeRegex = re.compile(r'([0-9]+):([0-9]+):([0-9]+)')
-__resACLRegex = re.compile(r'^\s*ACL:.*USER==(\w+)', re.MULTILINE)
-__resAccountingRegex = re.compile(r'^\s*Accounting.*User:(\w+)', re.MULTILINE)
-__newlineRegex = re.compile(r'\n')
-__emptyLineRegex = re.compile(r'\n[\s\n]*\n')
-__equalRegex = re.compile(r'[ ]+=[ ]+')
-__jobIdRegex = re.compile(r'[^\d]*([\d\-]+.*)')
-__jobSplitRegex = re.compile(r'\nJob Id')
-__queueRegex = re.compile(r'Queue: (.+)')
-__hostsInfoDict = None
-__hostsInfoList = None
-__jobsInfoDict = None
-__jobsInfoList = None
-__queuesInfoList = None
-__queuesInfoDict = None
+def getHostData(hostnames=None):
+	connection = pbs.Connection()
+	hostsInfo = []
+	
+	if hostnames==None:
+		info = connection.get_node_status()
+		for host in info:
+			hostsInfo.append(decodeHostData(host))
+	else:
+	
+		for hostname in hostnames:
+			info = connection.get_node_status([hostname])
+			if len(info) < 1:
+				continue
+			hostsInfo.append(decodeHostData(info[0]))	
+	connection.disconnect()
+	return hostsInfo
+		
+def decodeHostData(info):
+	current_host = HostInfo()
+	current_host.host_name = info[0]
+	attributes = info[1]
+	current_host.os_name = attributes["resources_available.arch"]
+	current_host.cpu_count = attributes["resources_available.ncpus"]
+	current_host.total_mem = attributes["resources_available.mem"]
+	current_host.used_mem = attributes["resources_assigned.mem"]
+	jobs = attributes["jobs"]
+	m = JobsRegex.match(jobs)
+	while m!=None:
+		current_host.jobs.append(m.group(1))
+		jobs = m.group(2)
+		m = JobsRegex.match(jobs)
+	return current_host
 
-def __checknodeResRegexExp(value):
-    return "User \'" + value + "\'.*Procs: (\d+)/(\d+)" 
+def getJobData(jobnames=None):
+	connection = pbs.Connection()
+	jobsInfo = []
+	
+	if jobnames==None:
+		info = connection.get_job_status()
+		for job in info:
+			jobsInfo.append(decodeJobData(job))
+	else:
+	
+		for jobname in jobnames:		
+			info = connection.get_job_status([jobname])
+			if len(info) < 1:
+				continue
+			jobsInfo.append(decodeJobData(info[0]))	
+	connection.disconnect()
+	return jobsInfo
 
-__defaultOwner = "root"
-__checknodeROI = "Reservations:"
+def decodeJobData(info):
+	current_job = JobInfo()
+	current_job.job_id = info[0]
+	attributes = info[1]
+	current_job.job_name = attributes["Job_Name"]
+	current_job.job_status = attributes["job_state"]
+	current_job.owner_name = attributes["Job_Owner"]
+	current_job.queue_name = attributes["queue"]
+	current_job.submission_time = attributes["ctime"]
+	current_job.start_time = attributes["etime"]	
+	return current_job
+	
+	
+def getQueueData(queuenames=None):
+	connection = pbs.Connection()
+	queuesInfo = []
+	jobsInfo = getJobData()
+	if queuenames == None:
+		info = connection.get_queue_status()
+		for queue in info:
+			queuesInfo.append(decodeQueueData(queue, jobsInfo))
+	else:	
+		for queuename in queuenames:
+			info = connection.get_queue_status([queuename])
+			if len(info)<1:
+				continue
+			queuesInfo.append(decodeQueueData(info[0], jobsInfo))		
+	return queuesInfo
 
-__postfixTable = {
-    "": 1,
-    "b": 1,
-    "kb": 1024,
-    "mb": 1024*1024,
-    "gb": 1024*1024*1024
-}
-
-def __extractPostFix(value):
-    m = __valueRegex.match(value)
-    ret = [m.group(1)]
-    if m.group(2)!=None:
-        ret.append(m.group(2))
-    else:
-        ret.append("")
-    return ret
-
-def __calculateValue(value):
-    p = __extractPostFix(value)
-    try:
-      return float(round(float(p[0]) \
-           *__postfixTable.get(p[1]))) 
-    except:
-      return 0
-
-def __commandOutputToDict(output, items_list=None, key_regex=None, split_regex=None):
-    if split_regex == None:
-        blocks_list = __emptyLineRegex.split(output)
-    else:
-        blocks_list = split_regex.split(output)
-    items_dictionary = {}
-    for block in blocks_list:
-        if block.lstrip() == "":
-            continue
-        block_lines = __newlineRegex.split(block)
-
-        if key_regex != None:
-            block_name = key_regex.match(block_lines[0]).group(1)
-        else:
-            block_name = block_lines[0]
-
-        block_lines = block_lines[1:]
-        block_dict = {}
-        for line in block_lines:
-            tuple = __equalRegex.split(line, 1)
-            if len(tuple) == 2:
-                block_dict[ tuple[0].strip() ] = tuple[1].strip()
-
-        if items_list != None:
-            items_list.append(block_name)
-
-        items_dictionary[block_name] = block_dict
-     
-    return items_dictionary
-
-def getHostData():
-    global __hostsInfoDict
-    global __hostsInfoList
-    if __hostsInfoList is not None:
-        return (__hostsInfoList, __hostsInfoDict)
- 
-    hostsInfoDict = dict()
-    hostsInfoList = []
-    pbsnodes_output = _pbsnodes(['-a'])
-    nodes_property = os.getenv("QCG_NODE_PROPERTY_ATTR")
-    nodes_filter = os.getenv("QCG_NODE_FILTER")
-    if nodes_filter != None:
-        try:
-            nodes_filter_key = nodes_filter.split(":")[0]
-            nodes_filter_regex_str = nodes_filter.split(":")[1]
-            if nodes_filter_regex_str[:1] == '~':
-                nodes_filter_negative = True
-                nodes_filter_regex_str = nodes_filter_regex_str[1:]
-            else:
-                nodes_filter_negative = False
-            nodes_filter_regex = re.compile(nodes_filter_regex_str)
-        except Exception:
-            raise GMInternalError("QCG_NODE_FILTER: Invalid format: '" + nodes_filter + "':. Expected: 'field:regex'")
-
-    pbsnodes_nodes_list = __emptyLineRegex.split(pbsnodes_output)
-    nodes_list = []
-    nodes_dictionary = __commandOutputToDict(pbsnodes_output, nodes_list)
-
-    for node_name in nodes_list:
-        current_host = HostInfo()
-        current_host.HostName = node_name;
-
-        node_properties = nodes_dictionary[node_name];
-        if nodes_filter != None:
-            if nodes_filter_key not in node_properties:
-                current_host.Dedicated = True
-            if (nodes_filter_regex.search(node_properties[nodes_filter_key]) == None) ^ nodes_filter_negative:
-                current_host.Dedicated = True
-
-        if node_properties['state'].find("down") != -1: 
-            current_host.State = "down"
-        elif node_properties['state'].find("offline") != -1:
-            current_host.State = "offline"
-        elif node_properties['state'].find("state-unknown") != -1:
-            current_host.State = "down"
-        else:
-            current_host.State = "up"
-
-        if nodes_property is not None and nodes_property in node_properties:
-            current_host.AdditionalResources = node_properties[nodes_property]
-
-        current_host.CpuArch = "x86_64"
-    
-        try:
-            current_host.TotalMemory = __calculateValue(node_properties["resources_available.mem"])
-            current_host.CpuCount = int(node_properties['resources_available.ncpus'])
-            current_host.UsedCpuCount = int(node_properties['resources_assigned.ncpus'])
-            current_host.TotalSwap = 0.0
-            hostsInfoDict[node_name] = current_host
-            hostsInfoList.append(current_host)
-        except:
-            pass
-
-    return (hostsInfoList, hostsInfoDict)
-
-def __decodeHostStatusField(status):
-    ret = {} 
-    for m in __statusRegex.finditer(status):
-        ret[m.group(1)] = m.group(2)        
-    return ret
-
-def __decodeQueueStateField(state):
-    ret = {}
-    for m in __queueStateRegex.finditer(state):
-        ret[m.group(1)] = m.group(2)
-    return ret
-
-def __decodeTimeDelta(time):
-    match = __walltimeRegex.match(time)
-    sec = int(match.group(1)) * 3600 + int(match.group(2)) * 60 + int(match.group(3))
-    return datetime.timedelta(seconds=sec) 
-        
-def getJobData():
-    global __jobsInfoList 
-    global __jobsInfoDict 
-      
-    if __jobsInfoList is not None: 
-         return (__jobsInfoList,__jobsInfoDict) 
-
-    __jobsInfoDict = dict()
-    __jobsInfoList = []
-    qstat_output = _qstat(['-f'])
-    job_list = __commandOutputToDict(qstat_output, None, __jobIdRegex, __jobSplitRegex)
-    for jobid,job_info in job_list.iteritems():
-        decoded_job = __decodeJobData(jobid, job_info)
-        __jobsInfoList.append(decoded_job)
-        __jobsInfoDict[jobid] = decoded_job
-
-    return (__jobsInfoList,__jobsInfoDict) 
-
-def __decodeJobData(jobid, attributes):
-    current_job = JobInfo()
-    current_job.JobID = jobid
-    current_job.JobName = attributes["Job_Name"]
-    if attributes["job_state"] == "R" or attributes["job_state"] == "E":
-        current_job.JobStatus = "Running"
-    elif attributes["job_state"] == "Q":
-        current_job.JobStatus = "Pending"
-    elif attributes["job_state"] == "C" or attributes["job_state"] == "F":
-        current_job.JobStatus = "Finished"
-    else:
-        current_job.JobStatus = "Unknown"
-    current_job.OwnerName = attributes["Job_Owner"].split("@")[0]
-    current_job.QueueName = attributes["queue"]
-    current_job.SubmissionTime = datetime.datetime(*time.strptime(attributes["qtime"])[:6])
-    current_job.TotalCores = int(attributes["Resource_List.ncpus"])
-
-    #TODO walltime, cputime, estimated time, comment
-    if "resources_used.mem" in attributes:
-        current_job.MemUsage =  long(__calculateValue(attributes["resources_used.mem"]) / (1024*1024))
-    if "resources_used.cput" in attributes:
-        current_job.CpuTime = __decodeTimeDelta(attributes["resources_used.cput"]) 
-    if "resources_used.walltime" in attributes: 
-        current_job.Walltime = __decodeTimeDelta(attributes["resources_used.walltime"]) 
-    if "comment" in attributes:
-        current_job.Comment = attributes["comment"]
-
-    if attributes["job_state"] == "Q":
-        try:
-            current_job.EstStartTime = datetime.datetime(*time.strptime(attributes["estimated.start_time"])[:6])
-        except:
-            pass
-    else:
-        current_job.StartTime = datetime.datetime(*time.strptime(attributes["mtime"])[:6])
-    return current_job
-
-def addExtendedJobData(job_ids, all_job_ids):
-    qstat_output = _qstat(['-n', '-1']).split("\n") #there is no huge difference if we want to parse all or just selected jobs
-    for line in qstat_output:
-        if len(line) > 0 and line[0].isdigit():
-            columns = line.split()
-            job_id = columns[0]
-            exec_host = columns[11]
-
-            for m in __execHostRegex.finditer(exec_host): 
-                host_name = m.group(1)
-                if m.group(3) != None:
-                    __jobsInfoDict[job_id].ExecutionHosts[host_name] = int(m.group(3))
-                else:
-                    __jobsInfoDict[job_id].ExecutionHosts[host_name] = 1 
-   
-    pass #PBS Pro is so cute that here we need just to get exec_hosts
-    
-def getQueueData():
-    global __queuesInfoList 
-    global __queuesInfoDict 
-
-    if __queuesInfoList is not None: 
-        return (__queuesInfoList, __queuesInfoDict) 
-
-    #TODO try to obtain default queue name
-    default_queue = None
-    qstat_output = _qstat([ '-f', '-Q'])
-    all_queues = __commandOutputToDict(qstat_output, None, __queueRegex)
-    __queuesInfoDict = dict()  
-    __queuesInfoList = []
-    for queue_name, queue_dict in all_queues.iteritems():
-            decodedQueue = __decodeQueueData(queue_name, queue_dict) 
-            if decodedQueue.QueueName == default_queue:
-                decodedQueue.IsDefault = True
-            __queuesInfoDict[queue_name] = decodedQueue
-            __queuesInfoList.append(decodedQueue)     
-
-    return (__queuesInfoList, __queuesInfoDict)
-
-def __decodeQueueData(queue_name, attributes):
-    current_queue = QueueInfo()
-    current_queue.QueueName = queue_name
-    queue_state = __decodeQueueStateField(attributes["state_count"])    
-    current_queue.PendingJobs = int(queue_state["Queued"])  
-    current_queue.RunningJobs = int(queue_state["Running"])
-    if "resources_default.walltime" in attributes.keys():
-        current_queue.Walltime = __decodeTimeDelta(attributes["resources_default.walltime"])
-    elif "resources_max.walltime" in attributes.keys():
-        current_queue.Walltime = __decodeTimeDelta(attributes["resources_max.walltime"])
-    else:
-        current_queue.Walltime = datetime.timedelta(0)  
-    current_queue.job_slots_aval = 0
-    current_queue.job_slots_total = 0
-    current_queue.Enabled = (attributes["enabled"] == "True")
-    current_queue.Started = (attributes["started"] == "True")
- 
-    return current_queue
-
-def _qstat(args):
-    try:
-        command = ['qstat']
-        command.extend(args)
-        sr = subprocess.Popen(command, stdout=subprocess.PIPE)
-    except OSError, e:
-        raise GMExternalError("qstat command failed, reason:\n" + str(e))        
-    
-    qstat_output = sr.communicate()[0]
-    if sr.returncode != 0:
-        if sr.returncode == 153:
-            raise GMUnknowJob("Unknow Job")
-        else:
-            raise GMExternalError("qstat command returned code: " + str(sr.returncode) + ". Details: " + qstat_output)
-    return qstat_output
-
-
-def _pbsnodes(args):
-    try:
-        command = ['pbsnodes']
-        command.extend(args)
-        sr = subprocess.Popen(command, stdout=subprocess.PIPE)
-    except OSError, e:
-        raise GMExternalError("pbsnodes command failed, reason:\n" + str(e))        
-    
-    pbsnodes_output = sr.communicate()[0]
-    if sr.returncode != 0:
-        raise GMExternalError("pbsnodes command returned code: " + str(sr.returncode))
-    return pbsnodes_output
-
-def getReservationData():
-    return ([], dict())
-
+def decodeQueueData(info, jobsInfo):
+	current_queue = QueueInfo()
+	current_queue.queue_name = info[0]
+	attributes = info[1]
+	current_queue.queue_type = attributes["queue_type"]
+	current_queue.job_slots_aval = -1
+	current_queue.job_slots_total = -1
+	if attributes["enabled"] == "True":
+		current_queue.queue_state = "enabled"
+	else:
+		current_queue.queue_state = "disabled"
+	for job in jobsInfo:
+		if job.queue_name == current_queue.queue_name:
+			current_queue.job_ids.append(job.job_id)
+	return current_queue
Index: trunk/src/modules/python/monitoring/grid_monitoring/common.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/common.py	(revision 1109)
+++ trunk/src/modules/python/monitoring/grid_monitoring/common.py	(revision 1)
@@ -1,35 +1,23 @@
 # $Id: InfoStorage.py 73 2010-03-13 01:36:13Z versor $
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 import datetime
-
-def asList(tuple):
-    return tuple[0]
-
-def asDict(tuple):
-   return tuple[1]
 
 class ReservationInfo(object):
     "Reservation information storage class"
-
+    
     __TYPE = [ "ar", "sr", "job" ]
-
+    
     def __init__(self):
         self.__reservation_name = ""
@@ -37,18 +25,18 @@
         self.__start_time = None
         self.__end_time = None
-        self.__owner = None
+        self.__owner = ""
         self.__resources = dict()
-
+        
     def __getReservationName(self):
         return self.__reservation_name
-
+    
     def __setReservationName(self, value):
         if not isinstance(value, str):
             raise TypeError("ReservationName must be a string")
         self.__reservation_name = value
-
+        
     def __getType(self):
         return self.__type
-
+    
     def __setType(self, value):
         if not isinstance(value, str):
@@ -56,17 +44,17 @@
         if not value in ReservationInfo.__TYPE:
             raise ValueError("Invalid reservation type")
-        self.__type = value
-
+        self.__type = value  
+        
     def __getStartTime(self):
         return self.__start_time
-
+    
     def __setStartTime(self, value):
         if not isinstance(value, datetime.datetime):
             raise TypeError("StartTime must be datetime object")
         self.__start_time = value
-
+        
     def __getEndTime(self):
         return self.__end_time
-
+    
     def __setEndTime(self, value):
         if not isinstance(value, datetime.datetime):
@@ -75,16 +63,16 @@
             raise ValueError("EndTime must be later than StartTime")
         self.__end_time = value
-
+        
     def __getOwner(self):
         return self.__owner
-
+    
     def __setOwner(self, value):
         if not isinstance(value, str):
             raise TypeError("Owner must be a string")
         self.__owner = value
-
+        
     def __getResources(self):
         return self.__resources
-
+    
     def __setResources(self, value):
         if not isinstance(value, dict):
@@ -96,44 +84,40 @@
                 raise TypeError("Values must be a integer")
         self.__resources = value
-
+        
     ReservationName = property(__getReservationName, __setReservationName, None, \
                                "String, gets/sets reservation name")
-
+    
     Type = property(__getType, __setType, None, \
                     "String, gets/sets reservation type")
-
+    
     StartTime = property(__getStartTime, __setStartTime, None, \
                          "DateTime, gets/sets reservation start time")
-
+    
     EndTime = property(__getEndTime, __setEndTime, None, \
                        "DateTime, gets/sets reservation end time")
-
+    
     Owner = property(__getOwner, __setOwner, None, \
                      "String, gets/sets reservation owner name")
-
+    
     Resources = property(__getResources, __setResources, None, \
                          "Dict, gets/sets dictionary containings resources name (as keys) and resource count (as values)")
-
+        
 
 class HostInfo(object):
     "Host information storage class"
-
+    
     __OS = [ "Unknown", "Winnt", "Solaris", "Linux", "LINUX" ]
-    __CPU_ARCH = [ "Other", "ARM", "IA-64", "MIPS", "RISC", "SPARC", "x86", "x86_64", "powerpc"]
-    __STATE = [ "down", "offline", "up" ]
-
-    def __init__(self):
-        self.__host_name = ""
+    __CPU_ARCH = [ "Other", "ARM", "IA-64", "MIPS", "RISC", "SPARC", "x86", "x86_64"]
+            
+    def __init__(self):                
+        self.__host_name = "" 
         self.__cpu_arch = "Unknown"
         self.__os_name = "Unknown"
-        self.__state = None
         self.__cpu_speed = 0.0
         self.__cpu_count = 1
-        self.__used_cpu_count = 0
-        self.__reserved_cpu_count = 0
         self.__cpu_utilization = None
         self.__15s_queue_lenght = None
         self.__1m_queue_lenght = None
-        self.__15m_queue_lenght = None
+        self.__15m_queue_lenght = None       
         self.__paging_activity = None
         self.__job_num = None
@@ -146,20 +130,18 @@
         self.__total_fs = None
         self.__queues = []
-        self.__jobs = None
-        self.__additional_resources = None
-        self.__dedicated = None
-        self.__gpu_count = None
-
-    def __getHostName(self):
+        self.__jobs = []
+        self.__additional_resources = dict()    
+    
+    def __getHostName(self):        
         return self.__host_name
-
+        
     def __setHostName(self, value):
         if not isinstance(value, str):
             raise TypeError("HostName must be a string")
         self.__host_name = value
-
-    def __getCpuArch(self):
+        
+    def __getCpuArch(self):        
         return self.__cpu_arch
-
+        
     def __setCpuArch(self, value):
         if value == None:
@@ -167,12 +149,12 @@
             return
         if not isinstance(value, str):
-            raise TypeError("Architecture name must be a string")
+            raise TypeError("Architecture name must be a string")        
         if not value in HostInfo.__CPU_ARCH:
-            raise ValueError("Invalid architecture name")
+            raise ValueError("Invalid architecture name")    
         self.__cpu_arch = value
-
-    def __getOsName(self):
+    
+    def __getOsName(self):        
         return self.__os_name
-
+        
     def __setOsName(self, value):
         if value == None:
@@ -183,23 +165,8 @@
         value = value.capitalize()
         if not value in HostInfo.__OS:
-            raise ValueError("Invalid OS name")
+            raise ValueError("Invalid OS name")    
         self.__os_name = value
 
-    def __getState(self):
-        return self.__state
-
-    def __setState(self, value):
-        if value == None:
-            self.__state = None
-            return
-        if not isinstance(value, str):
-            raise TypeError("Host state must be a string")
-        value = value.lower()
-        if not value in HostInfo.__STATE:
-            raise ValueError("Invalid host state")
-        self.__state = value
-
-
-    def __getCpuSpeed(self):
+    def __getCpuSpeed(self):        
         return self.__cpu_speed
 
@@ -209,7 +176,7 @@
         if value < 0.0:
             raise ValueError("CPU speed must be greater than 0")
-        self.__cpu_speed = value
-
-    def __getCpuCount(self):
+        self.__cpu_speed = value 
+        
+    def __getCpuCount(self):        
         return self.__cpu_count
 
@@ -219,29 +186,9 @@
         if value < 1:
             raise ValueError("CPU count must be greater than 0")
-        self.__cpu_count = value
-
-    def __getUsedCpuCount(self):
-        return self.__used_cpu_count
-
-    def __setUsedCpuCount(self, value):
-        if not isinstance(value, int):
-            raise TypeError("Used CPU count must be an integer")
-        if value < 0:
-            raise ValueError("Used CPU count must be positive integer")
-        self.__used_cpu_count = value
-
-    def __getReservedCpuCount(self):
-        return self.__reserved_cpu_count
-
-    def __setReservedCpuCount(self, value):
-        if not isinstance(value, int):
-            raise TypeError("CPU count must be an integer")
-        if value < 0:
-            raise ValueError("CPU count must be positive integer")
-        self.__reserved_cpu_count = value
-
-    def __getCpuUtilization(self):
+        self.__cpu_count = value        
+            
+    def __getCpuUtilization(self):        
         return self.__cpu_utilization
-
+    
     def __setCpuUtilization(self, value):
         if value == None:
@@ -250,39 +197,41 @@
         if not isinstance(value, float):
             raise TypeError("CpuUtilization should be a float")
-        self.__cpu_utilization = value
-
-    def __getQueueLenght15S(self):
+        if value < 0 or value > 100:
+            raise ValueError("CpuUtilization must be in 0-100 range")
+        self.__cpu_utilization = value    
+    
+    def __getQueueLenght15S(self):        
         return self.__15s_queue_lenght
-
+    
     def __setQueueLenght15S(self, value):
         if not isinstance(value, float):
             raise TypeError("QueueLenght15S should be a float")
         if value < 0:
-            raise ValueError("QueueLenght15S should be positive number")
+            raise ValueError("QueueLenght15S should be positive number")                
         self.__15s_queue_lenght = value
-
-    def __getQueueLenght1M(self):
+        
+    def __getQueueLenght1M(self):        
         return self.__1m_queue_lenght
-
+    
     def __setQueueLenght1M(self, value):
         if not isinstance(value, float):
             raise TypeError("QueueLenght1M should be a float")
         if value < 0:
-            raise ValueError("QueueLenght1M should be positive number")
+            raise ValueError("QueueLenght1M should be positive number")                
         self.__1m_queue_lenght = value
-
-    def __getQueueLenght15M(self):
+        
+    def __getQueueLenght15M(self):        
         return self.__15m_queue_lenght
-
+    
     def __setQueueLenght15M(self, value):
         if not isinstance(value, float):
             raise TypeError("QueueLenght15M should be a float")
         if value < 0:
-            raise ValueError("QueueLenght15M should be positive number")
+            raise ValueError("QueueLenght15M should be positive number")                
         self.__15m_queue_lenght = value
-
+        
     def __getPagingActivity(self):
         return self.__paging_activity
-
+    
     def __setPagingActivity(self, value):
         if not isinstance(value, float):
@@ -294,5 +243,5 @@
     def __getJobNum(self):
         return self.__job_num
-
+    
     def __setJobNum(self, value):
         if not isinstance(value, int):
@@ -304,5 +253,5 @@
     def __getJobMax(self):
         return self.__job_max
-
+    
     def __setJobMax(self, value):
         if not isinstance(value, int):
@@ -311,8 +260,8 @@
             raise ValueError("JobMax should be positive number")
         self.__job_max = value
-
+        
     def __getFreeMemory(self):
         return self.__free_mem
-
+    
     def __setFreeMemory(self, value):
         if not isinstance(value, float):
@@ -321,8 +270,8 @@
             raise ValueError("FreeMemory should be positive number")
         self.__free_mem = value
-
+        
     def __getFreeSwap(self):
         return self.__free_swap
-
+    
     def __setFreeSwap(self, value):
         if not isinstance(value, float):
@@ -331,8 +280,8 @@
             raise ValueError("FreeSwap should be positive number")
         self.__free_swap = value
-
+        
     def __getFreeFileSystem(self):
         return self.__free_fs
-
+    
     def __setFreeFileSystem(self, value):
         if not isinstance(value, float):
@@ -341,8 +290,8 @@
             raise ValueError("FreeFileSystem should be positive number")
         self.__free_fs = value
-
+        
     def __getTotalMemory(self):
         return self.__total_mem
-
+    
     def __setTotalMemory(self, value):
         if not isinstance(value, float):
@@ -351,8 +300,8 @@
             raise ValueError("TotalMemory should be positive number")
         self.__total_mem = value
-
+        
     def __getTotalSwap(self):
         return self.__total_swap
-
+    
     def __setTotalSwap(self, value):
         if not isinstance(value, float):
@@ -361,8 +310,8 @@
             raise ValueError("TotalSwap should be positive number")
         self.__total_swap = value
-
+        
     def __getTotalFileSystem(self):
         return self.__total_fs
-
+    
     def __setTotalFileSystem(self, value):
         if not isinstance(value, float):
@@ -371,46 +320,30 @@
             raise ValueError("TotalFileSystem should be positive number")
         self.__total_fs = value
-
+        
     def __getQueues(self):
         return self.__queues
-
+    
     def __setQueues(self, value):
         if not isinstance(value, list):
             raise TypeError("Queues must be a list")
         self.__queues = value
-
+        
     def __getJobs(self):
         return self.__jobs
-
+    
     def __setJobs(self, value):
         if not isinstance(value, list):
             raise TypeError("Jobs must be a list")
         self.__jobs = value
-
+    
     def __getAdditionalResources(self):
         return self.__additional_resources
-
+    
     def __setAdditionalResources(self, value):
-        if not isinstance(value, str):
-            raise TypeError("AdditionalResources must be a string")
+        if not isinstance(value, dict):
+            raise TypeError("AdditionalResources must be a dictionary")
         self.__additional_resources = value
-
-    def __getDedicated(self):
-        return self.__dedicated
-
-    def __setDedicated(self, value):
-        if not isinstance(value, bool):
-            raise TypeError("Dedicated must be a bool")
-        self.__dedicated = value
-
-    def __getGpuCount(self):
-        return self.__gpu_count
-
-    def __setGpuCount(self, value):
-        if not isinstance(value, int):
-            raise TypeError("GPU count must be an integer")
-        self.__gpu_count = value
-
-
+          
+        
     HostName = property(__getHostName, __setHostName, None, "Gets/sets host name")
     CpuArch = property(__getCpuArch, __setCpuArch, None, "Gets/sets CPU architecture name, valid values are\n\
@@ -421,7 +354,6 @@
     RISC,\n\
     SPARC,\n\
-    x86,\n\
-    x86_64")
-
+    x86")
+    
     OSName = property(__getOsName, __setOsName, None, \
     "Gets OS name. Valid values are:\n\
@@ -430,19 +362,8 @@
     Solaris,\n\
     Linux")
-
-    State = property(__getState, __setState, None, \
-    "Gets Host state. Valid values are:\n\
-    up,\n\
-    down,\n\
-    offline")
-
     CpuCount = property(__getCpuCount, __setCpuCount, None, "Integer, gets/sets CPU count")
-
-    UsedCpuCount = property(__getUsedCpuCount, __setUsedCpuCount, None, "Integer, gets/sets Used CPU count")
-
-    ReservedCpuCount = property(__getReservedCpuCount, __setReservedCpuCount, None, "Integer, gets/sets Reserved CPU count")
-
+    
     CpuSpeed = property(__getCpuSpeed, __setCpuSpeed, None, "Integer, gets/sets CPU speed")
-
+    
     CpuUtilization = property(__getCpuUtilization, __setCpuUtilization, None, \
                               "Float, gets/sets CPU utilization (average over minute) in percents")
@@ -455,16 +376,20 @@
     PagingActivity = property(__getPagingActivity, __setPagingActivity, None, \
                               "Float, gets/sets number of pages in/out per second")
+    JobNum = property(__getJobNum, __setJobNum, None, \
+                       "Int, gets/sets number of jobs currently running in system")
+    JobMax = property(__getJobMax, __setJobMax, None, \
+                       "Int, gets/sets maximum number of jobs that can be running simultaneously")
     FreeMemory = property(__getFreeMemory, __setFreeMemory, None, \
-                       "Float, gets/sets free memory on the host in bytes")
+                       "Float, gets/sets free memory on the host in MB")
     FreeSwap = property(__getFreeSwap, __setFreeSwap, None, \
-                        "Float, gets/sets free swap space on the host in bytes")
+                        "Float, gets/sets free swap space on the host in MB")
     FreeFilesystem = property(__getFreeFileSystem, __setFreeFileSystem, None, \
-                              "Float, gets/sets free space on the host file system in bytes")
+                              "Float, gets/sets free space on the host file system in MB")
     TotalMemory = property(__getTotalMemory, __setTotalMemory, None, \
-                       "Float, gets/sets total memory on the host in bytes")
+                       "Float, gets/sets total memory on the host in MB")
     TotalSwap = property(__getTotalSwap, __setTotalSwap, None, \
-                        "Float, gets/sets total swap space on the host in bytes")
+                        "Float, gets/sets total swap space on the host in MB")
     TotalFilesystem = property(__getTotalFileSystem, __setTotalFileSystem, None, \
-                              "Float, gets/sets total space on the host file system in bytes")
+                              "Float, gets/sets total space on the host file system in MB")
     Jobs = property(__getJobs, __setJobs, None, \
                     "List, gets/sets jobs currently scheduled on the host")
@@ -472,123 +397,108 @@
                       "List, gets/sets queues for whom host is currently available")
     AdditionalResources = property(__getAdditionalResources, __setAdditionalResources, None, \
-                        " gets/sets any additional resources on the host")
-    Dedicated = property(__getDedicated, __setDedicated, None, \
-                        " gets/sets if the access to the host is not generally accesible")
-
-    GpuCount = property(__getGpuCount, __setGpuCount, None, "Integer, gets/sets GPU count")
-
+                        "Dict, gets/sets any additional resources on the host")    
 
 class QueueInfo(object):
     "Host information storage class"
-
-    def __init__(self):
+        
+    def __init__(self):        
         self.__queue_name = ""
         self.__queue_priority = 0
-        self.__started = None
-        self.__enabled = None
+        self.__queue_active = False
+        self.__queue_open = False
         self.__pending_jobs = 0
         self.__running_jobs = 0
-        self.__max_jobs = 0
+        self.__max_jobs = 0        
         self.__job_ids = []
         self.__additional_info = dict()
         self.__is_default = False
         self.__walltime = None
-
+        
     def __getQueueName(self):
         return self.__queue_name
-
+    
     def __setQueueName(self, value):
         if not isinstance(value, str):
             raise TypeError("QueueName should be a string")
         self.__queue_name = value
-
+        
     def __getQueuePriority(self):
         return self.__queue_priority
-
+    
     def __setQueuePriority(self,value):
         if not isinstance(value, int):
             raise TypeError("QueuePriority should be an integer")
         self.__queue_priority = value
-
-    def __getEnabled(self):
-        return self.__enabled
-
-    def __setEnabled(self,value):
+        
+    def __getQueueEnabled(self):
+        return self.__queue_active
+    
+    def __setQueueEnabled(self,value):
         if not isinstance(value, bool):
-            raise TypeError("Enabled should be a bool value")
-        self.__enabled = value
-
-    def __getStarted(self):
-        return self.__started
-
-    def __setStarted(self,value):
-        if not isinstance(value, bool):
-            raise TypeError("Started should be a bool value")
-        self.__started = value
-
+            raise TypeError("QueueActive should be a bool value")
+        self.__queue_active = value    
+    
     def __getPendingJobs(self):
         return self.__pending_jobs
-
+    
     def __setPendingJobs(self,value):
         if not isinstance(value, int):
             raise TypeError("PendingJobs should be an integer")
         self.__pending_jobs = value
-
+        
     def __getRunningJobs(self):
         return self.__running_jobs
-
+    
     def __setRunningJobs(self,value):
         if not isinstance(value, int):
             raise TypeError("RunningJobs should be an integer")
         self.__running_jobs = value
-
+        
     def __getMaxJobs(self):
         return self.__max_jobs
-
+    
     def __setMaxJobs(self,value):
         if not isinstance(value, int):
             raise TypeError("MaxJobs should be an integer")
         self.__max_jobs = value
-
+        
     def __getJobIDs(self):
         return self.__job_ids
-
+    
     def __setJobIDs(self, value):
         if not isinstance(value, list):
             raise TypeError("JobIDs should be a list")
         self.__job_ids = value
-
+        
     def __getAdditionalInfo(self):
         return self.__additional_info
-
+    
     def __setAdditionalInfo(self,value):
         if not isinstance(value, dict):
             raise TypeError("AdditionalInfo should be a dictionary")
         self.__additional_info = value
-
+        
     def __getIsDefault(self):
         return self.__is_default
-
+    
     def __setIsDefault(self, value):
         if not isinstance(value, bool):
             raise TypeError("IsDefault should be bool")
         self.__is_default = value
-
+        
     def __getWalltime(self):
         return self.__walltime
-
+    
     def __setWalltime(self, value):
         if not isinstance(value, datetime.timedelta):
             raise TypeError("Walltime should be timedelta instance.")
-        self.__walltime = value
-
+        self.__walltime = value            
+        
     QueueName = property(__getQueueName, __setQueueName, None, \
                          "string, gets/sets queue name")
     QueuePriority = property(__getQueuePriority, __setQueuePriority, None, \
                              "integer, gets/sets queue priority level")
-    Enabled = property(__getEnabled, __setEnabled, None, \
-                           "bool, gets/sets if queue is enabled (accepts jobs)")
-    Started = property(__getStarted, __setStarted, None, \
-                           "bool, gets/sets if queue is started (dispatches & runs it jobs)")
+    QueueEnabled = property(__getQueueEnabled, __setQueueEnabled, None, \
+                           "bool, gets/sets if queue is enabled (dispatches & runs it jobs)")
     PendingJobs = property(__getPendingJobs, __setPendingJobs, None, \
                            "integer, gets/sets count of pending jobs in the queue")
@@ -606,11 +516,11 @@
                         "timedelta, gets/sets value of the walltime")
 
-
+        
 class JobInfo(object):
     "Job information storage class"
-
+    
     __STATUS = [ "Pending", "Running", "Suspended", "Done", "Exited", "Unknown" ]
-
-    def __init__(self):
+    
+    def __init__(self):        
         self.__job_id = ""
         self.__job_name = ""
@@ -620,43 +530,37 @@
         self.__submission_time = None
         self.__start_time = None
-        self.__est_start_time = None
         self.__end_time = None
-        self.__est_end_time = None
-        self.__execution_hosts = dict()
-        self.__mem_usage = None
-        self.__cpu_time = None
-        self.__description = None
-        self.__comment = None
-        self.__reservation_id = None
-        self.__total_cores = None
-        self.__walltime = None
-
+        self.__execution_hosts = []
+        self.__total_mem = 0
+        self.__total_swap = 0
+        self.__user_time = 0
+        self.__system_time = 0
+        
     def __getJobID(self):
         return self.__job_id
-
+    
     def __setJobID(self, value):
         if not isinstance(value, str):
-            raise TypeError("JobID should be a string")
+            raise TypeError("JobID should be a string") 
         self.__job_id = value
-
+        
     def __getJobName(self):
         return self.__job_name
-
+    
     def __setJobName(self,value):
         if not isinstance(value, str):
             raise TypeError("JobName should be a string")
-	self.__job_name = value
-
+        
     def __getOwnerName(self):
         return self.__owner_name
-
+    
     def __setOwnerName(self,value):
         if not isinstance(value, str):
             raise TypeError("OwnerName should be a string")
         self.__owner_name = value
-
+        
     def __getJobStatus(self):
         return self.__job_status
-
+    
     def __setJobStatus(self, value):
         if not isinstance(value, str):
@@ -665,145 +569,97 @@
             raise ValueError("Invalid status")
         self.__job_status = value
-
+    
     def __getQueueName(self):
         return self.__queue_name
-
+    
     def __setQueueName(self, value):
         if not isinstance(value, str):
             raise TypeError("QueueName should be a string")
         self.__queue_name = value
-
-    def __getDescription(self):
-        return self.__description
-
-    def __setDescription(self, value):
-        if not isinstance(value, str):
-            raise TypeError("Description should be a string")
-        self.__description = value
-
-    def __getComment(self):
-        return self.__comment
-
-    def __setComment(self, value):
-        if not isinstance(value, str):
-            raise TypeError("Comment should be a string")
-        self.__comment = value
-
-    def addComment(self, value):
-        if not isinstance(value, str):
-            raise TypeError("Comment should be a string")
-	if self.__comment is None:
-            self.__comment = value
-	else:
-	    self.___comment = self.__comment + "; " + value
-
- 
-    def __getReservationID(self):
-        return self.__reservation_id
-
-    def __setReservationID(self, value):
-        if not isinstance(value, str):
-            raise TypeError("ReservationID should be a string")
-        self.__reservation_id = value
-
+    
     def __getSubmissionTime(self):
-        return self.__submission_time
-
+        return self.__submission_time    
+    
     def __setSubmissionTime(self,value):
         if not isinstance(value, datetime.datetime):
             raise TypeError("SubmissionTime should be a datetime instance")
         self.__submission_time = value
-
+        
     def __getStartTime(self):
-        return self.__start_time
-
+        return self.__start_time    
+    
     def __setStartTime(self,value):
         if not (isinstance(value, datetime.datetime) or value == None):
             raise TypeError("StartTime should be a datetime instance")
         self.__start_time = value
-
+        
     def __getEndTime(self):
-        return self.__end_time
-
+        return self.__end_time    
+    
     def __setEndTime(self,value):
         if not (isinstance(value, datetime.datetime) or value == None):
             raise TypeError("EndTime should be a datetime instance")
         self.__end_time = value
-
-    def __getEstStartTime(self):
-        return self.__est_start_time
-
-    def __setEstStartTime(self,value):
-        if not (isinstance(value, datetime.datetime) or value == None):
-            raise TypeError("EstStartTime should be a datetime instance")
-        self.__est_start_time = value
-
-    def __getEstEndTime(self):
-        return self.__est_end_time
-
-    def __setEstEndTime(self,value):
-        if not (isinstance(value, datetime.datetime) or value == None):
-            raise TypeError("EstEndTime should be a datetime instance")
-        self.__est_end_time = value
-
+    
     def __getExecutionHosts(self):
         return self.__execution_hosts
-
+    
     def __setExecutionHosts(self, value):
-        if not isinstance(value, dict):
-            raise TypeError("ExecutionHosts should be a dict")
+        if not isinstance(value, list):
+            raise TypeError("ExecutionHosts should be a list")
         self.__execution_hosts = value
-
-    def __getMemUsage(self):
-        return self.__mem_usage
-
-    def __setMemUsage(self,value):
+        
+    def __getTotalMem(self):
+        return self.__total_mem
+        
+    def __setTotalMem(self,value):
         if (value == None):
-            self.__mem_usage = None
+            self.__total_mem = None
             return
-        if not isinstance(value, (int, long)):
-            raise TypeError("MemUsage should be an integer")
-        self.__mem_usage = value
-
-    def __getCpuTime(self):
-        return self.__cpu_time
-
-    def __setCpuTime(self,value):
+        if not isinstance(value, int):
+            raise TypeError("TotalMem should be an integer")
+        if value < 0:
+            raise ValueError("TotalMem should be positive number")
+        self.__total_mem = value
+        
+    def __getTotalSwap(self):
+        return self.__total_swap
+        
+    def __setTotalSwap(self,value):
         if (value == None):
-            self.__cpu_time = None
+            self.__total_swap = None
             return
-        if not isinstance(value, datetime.timedelta):
-            raise TypeError("CpuTime should be a timedelta")
-        self.__cpu_time = value
-
-    def __getWalltime(self):
-        return self.__walltime
-
-    def __setWalltime(self,value):
+        if not isinstance(value, int):
+            raise TypeError("TotalSwap should be an integer")
+        if value < 0:
+            raise ValueError("TotalSwap should be positive number")
+        self.__total_swap = value
+    
+    def __getUserTime(self):
+        return self.__user_time
+        
+    def __setUserTime(self,value):
         if (value == None):
-            self.__walltime = None
+            self.__user_time = None
             return
-        if not isinstance(value, datetime.timedelta):
-            raise TypeError("Walltime should be a timedelta")
-        self.__walltime = value
-
-    def __getTotalCores(self):
-        if self.__total_cores is None and len(self.__execution_hosts) > 0: #compute totalCores
-            self.__total_cores = 0
-            for hostname, slotsCount in self.__execution_hosts.items():
-                if slotsCount is not None:
-                    self.__total_cores = self.__total_cores + slotsCount
-            if self.__total_cores == 0:
-                self.__total_cores = None #no cores count info, rollback to None
-        return self.__total_cores
-
-    def __setTotalCores(self,value):
+        if not isinstance(value, int):
+            raise TypeError("UserTime should be an integer")
+        if value < 0:
+            raise ValueError("UserTime should be positive number")
+        self.__user_time = value
+        
+    def __getSystemTime(self):
+        return self.__system_time
+        
+    def __setSystemTime(self,value):
         if (value == None):
-            self.__total_cores = None
+            self.__system_time = None
             return
         if not isinstance(value, int):
-            raise TypeError("TotalCores should be an integer")
-        self.__total_cores = value
-
+            raise TypeError("UserTime should be an integer")
+        if value < 0:
+            raise ValueError("UserTime should be positive number")
+        self.__system_time = value    
+       
     JobID = property(__getJobID, __setJobID, None, \
                      "string, gets/sets job id")
@@ -822,9 +678,4 @@
     QueueName = property(__getQueueName, __setQueueName, None, \
                          "string, gets/sets queue name for this job")
-    ReservationID = property(__getReservationID, __setReservationID, None, \
-                         "string, gets/sets reservation id for this job")
-    Description = property(__getDescription, __setDescription, None, \
-                         "string, gets/sets description for this job")
-
     SubmissionTime = property(__getSubmissionTime, __setSubmissionTime, None, \
                               "Datetime, gets/sets job submission time")
@@ -833,21 +684,15 @@
     EndTime = property(__getEndTime, __setEndTime, None, \
                        "Datetime, gets/sets job finish time (if was finished, None otherwise)")
-    EstStartTime = property(__getEstStartTime, __setEstStartTime, None, \
-                         "Datetime, gets/sets estimated job dispatch time (if available, None otherwise)")
-    EstEndTime = property(__getEstEndTime, __setEstEndTime, None, \
-                       "Datetime, gets/sets estimated job finish time (if available, None otherwise)")
     ExecutionHosts = property(__getExecutionHosts, __setExecutionHosts, None, \
                               "List, gets/sets execution hosts list")
-    MemUsage = property(__getMemUsage, __setMemUsage, None, \
-                        "int|long, gets/sets total memory used in MB")
-    CpuTime = property(__getCpuTime, __setCpuTime, None, \
-                        "timedelta, gets/sets total cpu time used by job")
-    Walltime = property(__getWalltime, __setWalltime, None, \
-                        "timedelta, gets/sets total walltime used by job")
-    Comment = property(__getComment, __setComment, None, \
-                        "string, general job comment")
-    TotalCores = property(__getTotalCores, __setTotalCores, None, \
-                        "int, total number of cores (to be) used by the job")
-
+    TotalMem = property(__getTotalMem, __setTotalMem, None, \
+                        "int, gets/sets total memory used in MB")
+    TotalSwap = property(__getTotalSwap, __setTotalSwap, None, \
+                         "int, gets/sets total swap used in MB")
+    UserTime = property(__getUserTime, __setUserTime, None, \
+                        "int, gets/sets total user time used by job in seconds")
+    SystemTime = property(__getSystemTime, __setSystemTime, None, \
+                          "int, gets'sets total system time used by job in seconds")
+    
 
 __gridMonNSPrefix = "gmon"
@@ -876,5 +721,4 @@
     return __jsdlNS
 
-
 GridMonNSPrefix = property(__getGridMonNSPrefix, doc="Grid Monitoring namespace prefix")
 GridMonNS = property(__getGridMonNS, doc="Grid Monitoring namespace")
Index: trunk/src/modules/python/monitoring/grid_monitoring/core.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/core.py	(revision 627)
+++ trunk/src/modules/python/monitoring/grid_monitoring/core.py	(revision 1)
@@ -1,35 +1,25 @@
 # $Id$
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
 
 import sys
 import traceback
 
-_torque_type = "http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque"
-_pbs_type = "http://schemas.qoscosgrid.org/comp/2011/04/drms/PBSPro"
-_sge_type = "http://schemas.qoscosgrid.org/comp/2011/04/drms/SunGridEngine"
-_slurm_type = "http://schemas.qoscosgrid.org/comp/2011/04/drms/SLURM"
-_ll_type = "schemas.qoscosgrid.org/comp/2011/04/drms/Loadleveler"
+_torque_type = "http://schemas.qoscosgrid.org/comp/2011/04/drms/Torque/Torque"
+_sge_type = "http://schemas.qoscosgrid.org/comp/2011/04/drms/SunGridEngine/SGE-6.2u5"
 
 # method maps
 _capabilities = { }
 _jobDataHandlerMap = { }
-_extendedJobDataHandlerMap = { }
 _queueDataHandlerMap = { }
 _hostDataHandlerMap = { }
@@ -38,8 +28,17 @@
 #imports
 try:
+    import pbsimpl
+except ImportError:
+    _pbs_available = False
+
+try:
+    import lsfimpl
+except ImportError:
+    _lsf_available = False
+
+try:
     import sgeimpl
     _capabilities[_sge_type] = True
     _jobDataHandlerMap[_sge_type] = sgeimpl.getJobData
-    _extendedJobDataHandlerMap[_sge_type] = None #sgeimpl.getExtendedJobData
     _queueDataHandlerMap[_sge_type] = sgeimpl.getQueueData
     _hostDataHandlerMap[_sge_type] = sgeimpl.getHostData
@@ -47,5 +46,5 @@
 except ImportError:
     print >> sys.stderr, "Could not load SGE implementation\n", sys.exc_info()
-    _capabilities[_sge_type] = False
+    _capabilities[_sge_type] = False    
 
 try:
@@ -53,114 +52,71 @@
     _capabilities[_torque_type] = True
     _jobDataHandlerMap[_torque_type] = torqueimpl.getJobData
-    _extendedJobDataHandlerMap[_torque_type] = torqueimpl.addExtendedJobData
     _queueDataHandlerMap[_torque_type] = torqueimpl.getQueueData
     _hostDataHandlerMap[_torque_type] = torqueimpl.getHostData
     _reservationDataHandlerMap[_torque_type] = torqueimpl.getReservationData
-except None:
+except ImportError:
     print >> sys.stderr, "Could not load Torque implementation\n", sys.exc_info()
     _capabilities[_torque_type] = False
-
-try:
-    import pbsimpl
-    _capabilities[_pbs_type] = True
-    _jobDataHandlerMap[_pbs_type] = pbsimpl.getJobData
-    _extendedJobDataHandlerMap[_pbs_type] = pbsimpl.addExtendedJobData
-    _queueDataHandlerMap[_pbs_type] = pbsimpl.getQueueData
-    _hostDataHandlerMap[_pbs_type] = pbsimpl.getHostData
-    _reservationDataHandlerMap[_pbs_type] = pbsimpl.getReservationData
-except ImportError:
-    print >> sys.stderr, "Could not load PBS Pro implementation\n", sys.exc_info()
-    _capabilities[_pbs_type] = False
-
-try:
-    import slurmimpl
-    _capabilities[_slurm_type] = True
-    _jobDataHandlerMap[_slurm_type] = slurmimpl.getJobData
-    _extendedJobDataHandlerMap[_slurm_type] = slurmimpl.addExtendedJobData
-    _queueDataHandlerMap[_slurm_type] = slurmimpl.getQueueData
-    _hostDataHandlerMap[_slurm_type] = slurmimpl.getHostData
-    _reservationDataHandlerMap[_slurm_type] = slurmimpl.getReservationData
-except ImportError:
-    print >> sys.stderr, "Could not load SLURM implementation\n", sys.exc_info()
-    _capabilities[_slurm_type] = False
-
-try:
-    import llimpl
-    _capabilities[_ll_type] = True
-    _jobDataHandlerMap[_ll_type] = llimpl.getJobData
-    _extendedJobDataHandlerMap[_ll_type] = None #llimpl.getExtenedJobData
-    _queueDataHandlerMap[_ll_type] = llimpl.getQueueData
-    _hostDataHandlerMap[_ll_type] = llimpl.getHostData
-    _reservationDataHandlerMap[_ll_type] = llimpl.getReservationData
-except ImportError:
-    print >> sys.stderr, "Could not load LoadLeveler implementation\n", sys.exc_info()
-    _capabilities[_ll_type] = False
-
-def _remove_version_number(system_type):
-    return system_type[0:system_type.rindex("/")]
 
 def monitoringCapabilities():
     return _capabilities.copy()
 
-def getJobData(system_type):
+def getJobData(system_type, job_ids):
     if not isinstance(system_type, str):
         raise TypeError, "system type must be a string"
-    system_type = _remove_version_number(system_type);
+    if not job_ids == None:
+        for job in job_ids:
+            if not isinstance(job, str):
+                raise TypeError, "all jobs ids must be a string"
     if system_type in _jobDataHandlerMap:
         if system_type in _capabilities:
-            return _jobDataHandlerMap[system_type]()
+            return _jobDataHandlerMap[system_type](job_ids)
+        else:
+            raise NotImplementedError, "System type: " + system_type + " is not available for query"
+    else:
+        raise NotImplementedError, "System type: " + system_type + " is unknown" 
+
+def getQueueData(system_type, queue_names):
+    if not isinstance(system_type, str):
+        raise TypeError, "system type must be a string"
+    if not queue_names == None:
+        for queue in queue_names:
+            if not isinstance(queue, str):
+                raise TypeError, "all queue names must be a string"
+    if system_type in _jobDataHandlerMap:
+        if system_type in _capabilities:
+            return _queueDataHandlerMap[system_type](queue_names)
         else:
             raise NotImplementedError, "System type: " + system_type + " is not available for query"
     else:
         raise NotImplementedError, "System type: " + system_type + " is unknown"
-
-def addExtendedJobData(system_type, job_ids, all_job_ids):
+    
+def getHostData(system_type, host_names):
     if not isinstance(system_type, str):
         raise TypeError, "system type must be a string"
-    system_type = _remove_version_number(system_type);
+    if not host_names == None:
+        for host in host_names:
+            if not isinstance(host, str):
+                raise TypeError, "all host names must be a string"
     if system_type in _jobDataHandlerMap:
         if system_type in _capabilities:
-            _jobDataHandlerMap[system_type]() #make sure basic job data is generated
-            return _extendedJobDataHandlerMap[system_type](job_ids, all_job_ids)
+            return _hostDataHandlerMap[system_type](host_names)
         else:
             raise NotImplementedError, "System type: " + system_type + " is not available for query"
     else:
         raise NotImplementedError, "System type: " + system_type + " is unknown"
-
-
-def getQueueData(system_type):
+    
+def getReservationData(system_type, reservation_ids):
     if not isinstance(system_type, str):
         raise TypeError, "system type must be a string"
-    system_type = _remove_version_number(system_type);
-
+    if not reservation_ids == None:
+        for reservation in reservation_ids:
+            if not isinstance(reservation, str):
+                raise TypeError, "all reservation ids must be a string"
     if system_type in _jobDataHandlerMap:
         if system_type in _capabilities:
-            return _queueDataHandlerMap[system_type]()
+            return _reservationDataHandlerMap[system_type](reservation_ids)
         else:
             raise NotImplementedError, "System type: " + system_type + " is not available for query"
     else:
         raise NotImplementedError, "System type: " + system_type + " is unknown"
-
-def getHostData(system_type):
-    if not isinstance(system_type, str):
-        raise TypeError, "system type must be a string"
-    system_type = _remove_version_number(system_type);
-    if system_type in _jobDataHandlerMap:
-        if system_type in _capabilities:
-            return _hostDataHandlerMap[system_type]()
-        else:
-            raise NotImplementedError, "System type: " + system_type + " is not available for query"
-    else:
-        raise NotImplementedError, "System type: " + system_type + " is unknown"
-
-def getReservationData(system_type):
-    if not isinstance(system_type, str):
-        raise TypeError, "system type must be a string"
-    system_type = _remove_version_number(system_type);
-    if system_type in _jobDataHandlerMap:
-        if system_type in _capabilities:
-            return _reservationDataHandlerMap[system_type]()
-        else:
-            raise NotImplementedError, "System type: " + system_type + " is not available for query"
-    else:
-        raise NotImplementedError, "System type: " + system_type + " is unknown"
Index: trunk/src/modules/python/monitoring/grid_monitoring/miscutil.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/miscutil.py	(revision 656)
+++ trunk/src/modules/python/monitoring/grid_monitoring/miscutil.py	(revision 1)
@@ -1,20 +1,3 @@
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
-
+#!/usr/bin/env python
 class QueueType:
     UNKNOWN = 1
Index: trunk/src/modules/python/monitoring/grid_monitoring/slurmimpl.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/slurmimpl.py	(revision 1109)
+++ 	(revision )
@@ -1,379 +1,0 @@
-
-# $Id$
-
-#
-# QosCosGrid Computing
-# Copyright(C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.    If not, see <http://www.gnu.org/licenses/>
-#
-
-try:
-        from qcg.core import *
-except ImportError:
-        def error(msg): 
-                print >> sys.stderr, "[ERROR] " + msg
-        def info(msg): 
-                print >> sys.stderr, "[INFO] " + msg
-
-
-import datetime, sys, subprocess, re, traceback, time
-from common import HostInfo, QueueInfo, JobInfo, ReservationInfo
-from gmexceptions import GMInternalError, GMExternalError, GMUnknowJob
-
-__hostsInfoDict = None 
-__hostsInfoList = None 
-__jobsInfoDict = None 
-__jobsInfoList = None 
-__queuesInfoList = None 
-__queuesInfoDict = None 
-__reservationsInfoDict = None 
-__reservationsInfoList = None 
-__hostnamesDict = dict()
-
-def _runCommand(command, args):
-    try:
-        commandList = [command]
-        commandList.extend(args)
-        sr = subprocess.Popen(commandList, stdout=subprocess.PIPE)
-    except OSError:
-        raise GMExternalError(command + " command failed, reason:\n" + traceback.format_exc())
-
-    commandOutput = sr.communicate()[0]
-    if sr.returncode != 0:
-        raise GMExternalError(command + "    command returned code: " + str(sr.returncode) + ". Details: " + commandOutput)
-    return commandOutput
-
-def __decodeDatetime(strTime):
-    return datetime.datetime(*(time.strptime(strTime, '%Y-%m-%dT%H:%M:%S')[0:6]))
-
-def __decodeHostnames(hostnames):
-    if hostnames not in __hostnamesDict:
-        __hostnamesDict[hostnames] = _runCommand('scontrol', ['show', 'hostnames', hostnames]).splitlines()
-    return __hostnamesDict[hostnames]
-
-def __formatOutputDict(output, items_list=None, key_regex=None):
-
-    outputList = []
-
-    for line in output.splitlines():
-        propertiesDict = {}
-
-        for prop in line.split():
-            if not '=' in prop:
-                continue
-
-            name, value = prop.split('=', 1)
-
-            if value == '(null)':
-                value = None
-
-            propertiesDict[name] = value
-
-        outputList.append(propertiesDict)
-
-    return outputList
-
-def getHostData():
-    global __hostsInfoDict 
-    global __hostsInfoList 
-
-    if __hostsInfoList is not None: 
-        return(__hostsInfoList, __hostsInfoDict) 
-         
-    __hostsInfoDict = dict() 
-    __hostsInfoList = [] 
-
-    queueOutput = _runCommand('squeue', ['--states=r', '-h', '--format=%i %N'])
-    jobs = __decodeNodeJobs(queueOutput)
-
-    showPartitionOutput = _runCommand('scontrol', ['show', 'partition', '-o'])
-    partition = __decodePartitionNodes(showPartitionOutput)
-
-    showNodeOutput = _runCommand('scontrol', ['show', 'node', '-o'])
-    nodeDescList = __formatOutputDict(showNodeOutput)
-
-
-    for node in nodeDescList:
-        currentNode = HostInfo()
-        currentNode.HostName = node['NodeName']
-        currentNode.CpuCount = int(node['CPUTot'])
-        currentNode.UsedCpuCount = int(node['CPUAlloc'])
-        currentNode.TotalMemory = float(node['RealMemory']) * 2**20
-        if 'Features' in node and node['Features'] is not None:
-            currentNode.AdditionalResources = node['Features']
-        if 'Arch' in node:
-            currentNode.CpuArch = node['Arch']
-        if 'OS' in node:
-            currentNode.OSName = node['OS']
-
-        if 'Gres' in node and node['Gres'] is not None:
-            for gres in node['Gres'].split(','):
-#                print "found gres [", gres, "]"
-
-                grname, grvalue = gres.split(':', 1)
-                if grname is not None:
-                    if grname == 'gpu':
-                        if grvalue is not None and int(grvalue) > 0:
-                            currentNode.GpuCount = int(grvalue)
-
-
-        if int(node['TmpDisk']):
-            currentNode.TotalFilesystem = float(node['TmpDisk']) * 2**20
-
-        node['State'] = node['State'].lstrip('~')
-
-        if node['State'] in ['IDLE', 'ALLOCATED', 'ALLOCATED+', 'COMPLETING', 'MIXED', 'MIXED+COMPLETING', 'IDLE+POWER', 'IDLE+COMPLETING' ]:
-            currentNode.State = 'up'
-        elif node['State'] in ['DOWN', 'FAIL', 'FAILING'] or \
-                 node['State'][-1] == '*' or \
-                 node['State'].find("DOWN") != -1:
-            currentNode.State = 'down'
-        elif node['State'] in ['DRAINED', 'DRAINING', 'MAINT', 'UNKNOWN', 'IDLE+DRAIN', 'IDLE+DRAIN+POWER', 'RESERVED'] or \
-                 node['State'][-1] == '#' or \
-                 node['State'].find("DRAIN") != -1:
-            currentNode.State = 'offline'
-        else:
-                error("Unknown node state: " + node['State'] + " of node: " + node['NodeName'])
-                currentNode.State = 'offline'
-        
-        if currentNode.HostName in jobs:
-            currentNode.Jobs = jobs[currentNode.HostName]
-        if currentNode.HostName in partition:
-            currentNode.Queues = partition[currentNode.HostName]
-
-        __hostsInfoList.append(currentNode)
-        __hostsInfoDict[currentNode.HostName] = currentNode
-
-    return(__hostsInfoList,__hostsInfoDict)
-
-def __decodeNodeJobs(output):
-    jobs = {}
-
-    for jobInfo in output.splitlines():
-        jobInfo = jobInfo.split()
-
-        jobId = jobInfo[0]
-        jobNodes = __decodeHostnames(jobInfo[1])
-
-        for node in jobNodes:
-            if not node in jobs:
-                jobs[node] = []
-
-            jobs[node].append(jobId)
-
-    return jobs
-
-def __decodePartitionNodes(output):
-    partition = {}
-
-    partDescList = __formatOutputDict(output)
-
-    for p in partDescList:
-        if 'Nodes' in p and 'PartitionName' in p:
-            for node in __decodeHostnames(p['Nodes']):
-                if not node in partition:
-                    partition[node] = []
-    
-                partition[node].append(p['PartitionName'])
-
-    return partition
-
-def getJobData(jobids=None):
-    global __jobsInfoList 
-    global __jobsInfoDict 
-     
-    if __jobsInfoList is not None: 
-            return(__jobsInfoList,__jobsInfoDict) 
-
-    showJobOutput = _runCommand('scontrol', ['-a', 'show', 'job', '-o'])
-    if re.search("No jobs in the system", showJobOutput):
-        return(dict(),[])
-
-    jobDescList = __formatOutputDict(showJobOutput)
-
-    __jobsInfoDict = dict() 
-    __jobsInfoList = [] 
-
-    for job in jobDescList:
-        try:
-            currentJob = JobInfo()
-            currentJob.JobID = job['JobId']
-            currentJob.JobName = job.get('Name', None) or job.get('JobName', None)
-            currentJob.OwnerName = job['UserId'][0:job['UserId'].find('(')]
-            currentJob.QueueName = job['Partition']
-            if job['SubmitTime'] != 'Unknown':
-                currentJob.SubmissionTime = __decodeDatetime(job['SubmitTime'])
-            if job['JobState'] in ['PENDING', 'CONFIGURING']:
-                currentJob.JobStatus = 'Pending'
-            elif job['JobState'] in ['RUNNING', 'COMPLETING']:
-                currentJob.JobStatus = 'Running'
-            elif job['JobState'] in ['CANCELLED', 'COMPLETED', 'FAILED', 'NODE_FAIL', 'TIMEOUT']:
-                currentJob.JobStatus = 'Done'
-            elif job['JobState'] == 'SUSPENDED':
-                currentJob.JobStatus = 'Suspended'
-            else:
-                currentJob.JobStatus = 'Unknown'
-    
-            if job['StartTime'] != 'Unknown':
-                if currentJob.JobStatus == "Pending":
-                    currentJob.EstStartTime = __decodeDatetime(job['StartTime'])
-                else:
-                    currentJob.StartTime = __decodeDatetime(job['StartTime'])
-    
-            if job['EndTime'] != 'Unknown' and currentJob.JobStatus == "Done":
-                currentJob.EndTime = __decodeDatetime(job['EndTime'])
-    
-    
-            # problem with obtaining an information about used slots
-            if job['NodeList'] is not None: 
-                for host in __decodeHostnames(job['NodeList']):
-                    currentJob.ExecutionHosts[host] = None
-    
-            if job['Reservation'] is not None:
-                currentJob.ReservationID = job['Reservation']
-        except:
-            error("Failed to parse job state" + str(job))
-        else:
-            __jobsInfoList.append(currentJob)
-            __jobsInfoDict[currentJob.JobID] = currentJob 
-
-    return(__jobsInfoList,__jobsInfoDict)
-
-def addExtendedJobData(job_ids, all_job_ids):
-    pass #TODO
-
-def getQueueData(queuenames=None):
-    global __queuesInfoList 
-    global __queuesInfoDict 
-    if __queuesInfoList is not None: 
-         return(__queuesInfoList, __queuesInfoDict) 
-
-    showPartitionOutput = _runCommand('scontrol', ['-a', 'show', 'partition', '-o'])
-    partDescList = __formatOutputDict(showPartitionOutput)
-
-    jobListOutput = _runCommand('squeue', ['-a', '--state=all', '-h', '--format=%i %P %t'])
-    jobs = __decodeJobList(jobListOutput)
-
-    __queuesInfoDict = dict()    
-    __queuesInfoList = [] 
-
-    for p in partDescList:
-        currentPart = QueueInfo()
-        currentPart.QueueName = p['PartitionName']
-        currentPart.QueuePriority = int(p['Priority'])
-        if p['State'] == 'UP':
-            currentPart.Started = True
-            currentPart.Enabled = True
-        elif p['State'] == 'DOWN':
-            currentPart.Started = False
-            currentPart.Enabled = True
-        elif p['State'] == 'DRAIN':
-            currentPart.Started = True
-            currentPart.Enabled = False
-        else:
-            currentPart.Started = False
-            currentPart.Enabled = False
- 
-        currentPart.IsDefault = bool(p['Default'] == 'YES')
-        if p['MaxTime'] != 'UNLIMITED':
-            currentPart.Walltime = __decodeTimeDelta(p['MaxTime'])
-        else:
-            currentPart.Walltime = datetime.timedelta(0)
-
-        if currentPart.QueueName in jobs:
-            currentPart.PendingJobs = len(jobs[currentPart.QueueName][0])
-            currentPart.RunningJobs = len(jobs[currentPart.QueueName][1])
-
-            currentPart.JobIDs = jobs[currentPart.QueueName][0] + jobs[currentPart.QueueName][1]
-
-        __queuesInfoList.append(currentPart)
-        __queuesInfoDict[currentPart.QueueName] = currentPart
-
-    return(__queuesInfoList, __queuesInfoDict)
-
-def __decodeTimeDelta(time):
-    time = time.split('-')
-    days = 0
-    if len(time) > 1:
-        days = int(time[0])
-        time = [time[1]]
-    else:
-        days = 0
-
-    hours, minutes, seconds = time[0].split(':')
-
-    return datetime.timedelta(days=int(days), hours=int(hours), minutes=int(minutes), seconds=int(seconds))
-
-def __decodeJobList(output):
-    jobs = {}
-
-    for job in output.splitlines():
-        jobId, part, status = job.split()
-
-        if not part in jobs:
-            jobs[part] = [[], []]
-
-        if status in ['CF', 'PD', 'S']:    # pending
-            jobs[part][0].append(jobId)
-        elif    status in ['R', 'CG']:         # running
-            jobs[part][1].append(jobId)
-
-    return jobs
-
-def getReservationData(reservation_names=None):
-    global __reservationsInfoList 
-    global __reservationsInfoDict 
-
-    if __reservationsInfoList is not None: 
-            return(__reservationsInfoList, __reservationsInfoDict) 
-
-    __reservationsInfoList = [] 
-    __reservationsInfoDict = dict() 
-
-    showResOutput = _runCommand('scontrol', ['-a', 'show', 'reservation', '-o'])
-    if re.search("No reservations in the system", showResOutput):
-        return ([],dict())
-
-    resDescList = __formatOutputDict(showResOutput)
-
-    showNodeOutput = _runCommand('scontrol', ['-a', 'show', 'node', '-o']) #TODO cache
-    nodeDescList = __formatOutputDict(showNodeOutput)
-    nodeDescDict = dict([(n['NodeName'], n) for n in nodeDescList])
-
-
-    for res in resDescList:
-        currentRes = ReservationInfo()
-        currentRes.ReservationName = res['ReservationName']
-        currentRes.StartTime = __decodeDatetime(res['StartTime'])
-        currentRes.EndTime = __decodeDatetime(res['EndTime'])
-        if 'MAINT' in res['Flags'].split(','):
-            currentRes.Type = 'sr'
-        else:
-            currentRes.Type = 'ar'
-
-        if res['Users'] is not None:
-            currentRes.Owner = res['Users'].split(',')[0]
-        else:
-            currentRes.Owner = res['Accounts'].split(',')[0]
-
-        if res['Nodes'] is not None:
-                for node in __decodeHostnames(res['Nodes']):
-                        if node in nodeDescDict and 'CPUTot' in nodeDescDict[node]:
-                                currentRes.Resources[node] = int(nodeDescDict[node]['CPUTot'])
-
-        __reservationsInfoList.append(currentRes)
-        __reservationsInfoDict[currentRes.ReservationName] = currentRes
-
-    return(__reservationsInfoList, __reservationsInfoDict)
Index: trunk/src/modules/python/monitoring/grid_monitoring/llimpl.py
===================================================================
--- trunk/src/modules/python/monitoring/grid_monitoring/llimpl.py	(revision 656)
+++ 	(revision )
@@ -1,226 +1,0 @@
-
-# $Id$
-
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
-
-import datetime, sys, subprocess, re, traceback, time
-from common import HostInfo, QueueInfo, JobInfo, ReservationInfo
-from gmexceptions import GMInternalError, GMExternalError, GMUnknowJob
-
-def _runCommand (command):
-	try:
-		sr = subprocess.Popen (command, stdout=subprocess.PIPE, shell=True)
-		commandOutput = sr.communicate()[0]
-	except OSError, e:
-		raise GMExternalError (command + " command failed, reason:" + str (e))
-
-	if sr.returncode != 0:
-		raise GMExternalError (command + " command returned code: " + str (sr.returncode) + ". Details: " + commandOutput)
-
-	return commandOutput
-
-
-def _output2dicts (output, keys):
-	'''Convert lists separated by an exclamation point (!) to dicts with given keys'''
-
-	if re.search ("There is currently no .* status to report.", output):
-		return []
-
-	return [dict (zip (keys, line.split('!'))) for line in output.splitlines()]
-
-
-def _str2datatime (s):
-	'''Convert string in proper format to datetime object'''
-
-	return datetime.datetime (*(time.strptime (s, "%m/%d/%Y %H:%M")[0:6]))
-
-
-def _str2datatime2 (s):
-	'''Convert string in proper format to datetime object'''
-
-	return datetime.datetime (*(time.strptime (s, "%a %d %b %Y %I:%M:%S %p %Z")[0:6]))
-
-
-def getHostData (hostnames=None):
-	statusOutput = _runCommand ("llstatus -r %n %cpu %l %v %d %m %sts %a %o")
-	nodeList = _output2dicts (statusOutput, ['name', 'cpus', 'ldAvg', 'freeVMem',
-	                                         'freeDisk', 'mem', 'state', 'arch', 'opSys'])
-
-	jobs = getJobData()
-	nodeJobs = {}
-	for job in jobs:
-		for node in job.ExecutionHosts.iterkeys():
-			if node not in nodeJobs:
-				nodeJobs[node] = []
-
-			nodeJobs[node].append (job.JobID)
-
-	hostInfoList = []
-	for node in nodeList:
-		hostInfo = HostInfo()
-		hostInfo.HostName = node['name']
-		hostInfo.CpuCount = int (node['cpus'])
-		hostInfo.CpuUtilization = float (node['ldAvg'])
-		hostInfo.FreeSwap = float (node['freeVMem']) * 2**10 # kB to B
-		hostInfo.FreeFilesystem = float (node['freeDisk']) * 2**10 # kB to B
-		hostInfo.TotalMemory = float (node['mem']) * 2**10 # kB to B
-
-		if node['state'] in ["Busy", "Idle", "Running"]:
-			hostInfo.State = "up"
-		elif node['state'] in ["Down"]:
-			hostInfo.State = "down"
-		elif node['state'] in ["Drained", "Draining", "Flush", "None", "Suspend"]:
-			hostInfo.State = "offline"
-
-		# default powerpc, node['arch'] not used
-		hostInfo.CpuArch = "powerpc"
-
-		# default linux, node['opSys'] not used
-		hostInfo.OSName = "linux"
-
-		if hostInfo.HostName in nodeJobs:
-			hostInfo.Jobs = nodeJobs[hostInfo.HostName]
-
-		#TODO ?
-		#hostInfo.Queue = (llstatus -r )
-
-		hostInfoList.append (hostInfo)
-
-	return hostInfoList
-
-
-def getJobData (jobids=None):
-	llqOutput = _runCommand ("llq -r %id %jn %o %st %c %R %dq %dd %dc %h")
-	jobList = _output2dicts (llqOutput, ['id', 'name', 'owner', 'status', 'class', 'resId',
-	                                     'subTime', 'startTime', 'endTime', 'nodes'])
-
-	jobInfoList = []
-
-	for job in jobList:
-		jobInfo = JobInfo()
-		jobInfo.JobID = job['id']
-		jobInfo.JobName = job['name']
-		jobInfo.OwnerName = job['owner']
-		jobInfo.QueueName = job['class']
-		#jobInfo.Description = (llq -l, comment)
-
-		if job['status'] in ['D', 'I', 'NQ', 'NR', 'P', 'X', 'XP', 'RP', 'ST', 'S', 'HS', 'H']:
-			jobInfo.JobStatus = 'Pending'
-		elif job['status'] in ['CK', 'CP', 'EP', 'MP', 'R']:
-			jobInfo.JobStatus = 'Running'
-		elif job['status'] in ['E', 'V', 'VP']:
-			jobInfo.JobStatus = 'Suspended'
-		elif job['status'] in ['CA', 'C', 'RM', 'TX']:
-			jobInfo.JobStatus = 'Done'
-		else:
-			jobInfo.JobStatus = 'Unknown'
-
-		if len (job['resId']) > 0:
-			jobInfo.ReservationID = job['resId']
-
-		jobInfo.SubmissionTime = _str2datatime (job['subTime'])
-
-		if len (job['startTime']) > 0:
-			jobInfo.StartTime = _str2datatime (job['startTime'])
-
-		if len (job['endTime']) > 0:
-			jobInfo.EndTime = _str2datatime (job['endTime'])
-
-		#FIXME precise number
-		if len (job['nodes']) > 0:
-			for node in job['nodes'].split(','):
-				jobInfo.ExecutionHosts[node] = 1
-
-		jobInfoList.append (jobInfo)
-
-	return jobInfoList
-
-
-def getQueueData (queuenames=None):
-	llclassOutput = _runCommand ("llclass -l")
-
-	classDict = {}
-	cl = None
-	for line in llclassOutput.splitlines():
-		match = re.search ("^=+ Class (?P<name>\w+) =+$", line)
-
-		if match is not None:
-			cl = match.group('name')
-			classDict[cl] = {}
-			classDict[cl]['PendingJobs'] = []
-			classDict[cl]['RunningJobs'] = []
-		elif re.search ("^-+$", line):
-			break
-		elif cl is not None:
-			prop, val = line.split (':', 1)
-			classDict[cl][str.strip (prop)] = str.strip (val)
-
-	jobInfoList = getJobData()
-	for job in jobInfoList:
-		if job.QueueName in classDict:
-			if job.JobStatus == 'Pending':
-				classDict[job.QueueName]['PendingJobs'].append (job.JobID)
-			elif job.JobStatus == 'Running':
-				classDict[job.QueueName]['RunningJobs'].append (job.JobID)
-
-	queueInfoList = []
-
-	for cl, clProps in classDict.iteritems():
-		queueInfo = QueueInfo()
-		queueInfo.QueueName = cl
-		queueInfo.QueuePriority = int (clProps['Priority'])
-		queueInfo.QueueEnabled = True
-		queueInfo.MaxJobs = int (clProps['Maximum_slots'])
-		queueInfo.PendingJobs = len (clProps['PendingJobs'])
-		queueInfo.RunningJobs = len (clProps['RunningJobs'])
-		queueInfo.JobIDs = clProps['PendingJobs'] + clProps['RunningJobs']
-		queueInfo.IsDefault = bool (cl == 'No_Class')
-
-		match = re.search ("\((?P<name>\d+) seconds", clProps['Wall_clock_limit'])
-
-		if match is not None:
-			queueInfo.Walltime = datetime.timedelta (seconds = int (match.group('name')))
-
-		queueInfoList.append (queueInfo)
-
-	return queueInfoList
-
-
-def getReservationData (reservation_names=None):
-	llqresOutput = _runCommand ("llqres -r")
-	resList = _output2dicts (llqresOutput, ['id', 'creationTime', 'owner', 'group',
-	                                        'startTime', 'duration', 'endTime', 'shared',
-	                                        'rmOnIdle', 'status', 'modBy', 'modeTime',
-	                                        'usersNo', 'usersList', 'groupsNo', 'groupsList',
-	                                        'nodesNo', 'nodesList', 'jobsNo', 'jobsList'])
-
-	reservationInfoList = []
-
-	for res in resList:
-		resInfo = ReservationInfo()
-		resInfo.ReservationName = res['id']
-		resInfo.Type = 'ar'
-		resInfo.StartTime = _str2datatime2 (res['startTime'])
-		resInfo.EndTime = _str2datatime2 (res['endTime'])
-		resInfo.Owner = res['owner']
-		#resInfo.Resources =
-
-		reservationInfoList.append (resInfo)
-
-	return reservationInfoList
Index: trunk/src/modules/python/monitoring/monitoring.py
===================================================================
--- trunk/src/modules/python/monitoring/monitoring.py	(revision 1109)
+++ trunk/src/modules/python/monitoring/monitoring.py	(revision 1)
@@ -1,43 +1,23 @@
 # $Id$
 
-#
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
-#
-
-from datetime import datetime, timedelta
-import os
-
-try:
-    from qcg.core import *
-    from qcg.comp import *
-except ImportError:
-    class Module:
-        pass
-    def error(msg):
-        print "[ERROR]: " + msg
-    def info(msg):
-        print "[INFO]: " + msg
-    def debug(msg):
-        print "[DEBUG]: " + msg
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+
+#      http://www.apache.org/licenses/LICENSE-2.0
+
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+from qcg.core import *
+from qcg.comp import *
 
 
 try:
     import grid_monitoring
-    from grid_monitoring.gmexceptions import GMError, GMInternalError, GMExternalError, GMUnknowJob
-    from grid_monitoring.common import asDict,asList
+    from grid_monitoring.gmexceptions import GMInternalError, GMExternalError, GMUnknowJob
 except ImportError:
     error("Unable to load grid_monitoring module")
@@ -46,12 +26,7 @@
 from xml.dom.minidom import Document
 import datetime
-import sys
 
 __MonitoringNSPrefix = "monitoring"
 __MonitoringNS = "http://schemas.qoscosgrid.org/comp/2011/04/monitoring"
-__QCGFactoryNSPrefix = "qcf"
-__QCGFactoryNS = "http://schemas.qoscosgrid.org/comp/2011/04/factory"
-
-__FactoryNS = "http://schemas.qoscosgrid.org/comp/2011/04/factory"
 __BesFactoryNSPrefix = "bes-factory"
 __BesFactoryNS = "http://schemas.ggf.org/bes/2006/08/bes-factory"
@@ -76,68 +51,34 @@
     """Gets XML from JobInfo entity"""
     doc = Document()        
-    activityInfo = doc.createElementNS(__QCGFactoryNS, "ActivityInfo")        
-    activityInfo.setAttribute("xmlns", __QCGFactoryNS)
-    doc.appendChild(activityInfo)
-
-    if jobInfo.EstStartTime is not None:
-        elem = doc.createElement("EstimatedStartTime")
-        text = doc.createTextNode(__toXmlDateTime(jobInfo.EstStartTime))
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-    if jobInfo.StartTime is not None:
-        elem = doc.createElement("StartTime")
-        text = doc.createTextNode(__toXmlDateTime(jobInfo.StartTime))
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-    if jobInfo.EndTime is not None:
-        elem = doc.createElement("EndTime")
-        text = doc.createTextNode(__toXmlDateTime(jobInfo.EndTime))
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-    executionNodes = ""    
-    for hostName, hostSlots in jobInfo.ExecutionHosts.items():
-        if len(executionNodes) > 0:
-            executionNodes = executionNodes + "|"
-        if hostSlots is not None:
-            executionNodes = executionNodes + hostName + ":" + str(hostSlots)
-        else:
-            executionNodes = executionNodes + hostName
-    
-    if len(executionNodes):
-        elem = doc.createElement("ExecutionNodes")
-        text = doc.createTextNode(executionNodes)
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-    if jobInfo.MemUsage is not None:
-        elem = doc.createElement("MemoryUsageInMB")
-        text = doc.createTextNode(str(jobInfo.MemUsage))
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-    if jobInfo.CpuTime is not None and \
-       jobInfo.TotalCores is not None and \
-       jobInfo.Walltime is not None:
-        walltime = jobInfo.Walltime
-        normWalltime = (walltime.days * 3600 * 24 + walltime.seconds) * jobInfo.TotalCores
-        cpuTimeSeconds = jobInfo.CpuTime.days * 3600 * 24 + jobInfo.CpuTime.seconds
-        elem = doc.createElement("Efficiency")
-        if normWalltime > 0:
-           text = doc.createTextNode(str(int(round((cpuTimeSeconds *100.0)/normWalltime))))
-        else:
-           text = doc.createTextNode("0")
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-    if jobInfo.Comment is not None:
-        elem = doc.createElement("Comment")
-        text = doc.createTextNode(jobInfo.Comment)
-        elem.appendChild(text)
-        activityInfo.appendChild(elem)
-
-
+    jobMonitoring = doc.createElementNS(__MonitoringNS, "JobMonitoring")        
+    jobMonitoring.setAttribute("xmlns", __MonitoringNS)
+    doc.appendChild(jobMonitoring)
+    executionHosts = doc.createElement("ExecutionHosts")
+    jobMonitoring.appendChild(executionHosts)
+    for hostTuple in jobInfo.ExecutionHosts:
+        host = doc.createElement("Host")
+        host.setAttribute("name", hostTuple[0])
+        host.setAttribute("slots", str(hostTuple[1]))
+        executionHosts.appendChild(host)
+
+    cpuTimeUsage = doc.createElement("CPUTimeUsage")
+        
+    time = jobInfo.UserTime
+    hours = time/3600
+    time = time - hours*3600
+    minutes = time/60
+    time = time - minutes*60
+    seconds = time
+    userTime = datetime.timedelta(hours=hours, minutes=minutes, seconds=seconds)
+    cpuTimeText = doc.createTextNode(str(userTime))        
+        
+    cpuTimeUsage.appendChild(cpuTimeText)
+    jobMonitoring.appendChild(cpuTimeUsage)
+        
+    memUsage = doc.createElement("MemUsage")
+    memUsageText = doc.createTextNode(str(jobInfo.TotalMem))
+    memUsage.appendChild(memUsageText)
+    jobMonitoring.appendChild(memUsage)
+            
     return doc
 
@@ -151,9 +92,6 @@
     cluster.setAttribute("xmlns:" + __JsdlNSPrefix, __JsdlNS)
     doc.appendChild(cluster)        
-
-    if len(asList(hostsInfo)) == 0:
-        raise GMError("No hosts returned") 
-
-    for host in asList(hostsInfo):
+    
+    for host in hostsInfo:
         containedResource = doc.createElement("ContainedResource")
         cluster.appendChild(containedResource)
@@ -177,60 +115,30 @@
         cpuCount.appendChild(text)
 
-        if(host.TotalMemory != None):
-            physicalMemory = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":PhysicalMemory")
-            containedResource.appendChild(physicalMemory)
-            text = doc.createTextNode(str(int(host.TotalMemory)))
-            physicalMemory.appendChild(text)
-        
-        if(host.TotalSwap != None):
-            virtualMemory = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":VirtualMemory")
-            containedResource.appendChild(virtualMemory)
-            text = doc.createTextNode(str(int(host.TotalSwap)))
-            virtualMemory.appendChild(text)
-        
-        if(host.CpuUtilization != None):
-            utilization = doc.createElementNS(__MonitoringNS, "Utilization")
-            containedResource.appendChild(utilization)
-            utilization.setAttribute("xmlns", __MonitoringNS)
-            text = doc.createTextNode(str(int(host.CpuUtilization * 100)))
-            utilization.appendChild(text)
-
-        if(host.AdditionalResources != None):
-            attrs = doc.createElementNS(__MonitoringNS, "Attributes")
-            containedResource.appendChild(attrs)
-            attrs.setAttribute("xmlns", __MonitoringNS)
-            text = doc.createTextNode(str(host.AdditionalResources))
-            attrs.appendChild(text)
-
-        if(host.State != None):
-            state = doc.createElementNS(__MonitoringNS, "State")
-            containedResource.appendChild(state)
-            state.setAttribute("xmlns", __MonitoringNS)
-            text = doc.createTextNode(str(host.State))
-            state.appendChild(text)
-        if(host.Dedicated != None):
-            dedicated = doc.createElementNS(__MonitoringNS, "Dedicated")
-            containedResource.appendChild(dedicated)
-            dedicated.setAttribute("xmlns", __MonitoringNS)
-            text = doc.createTextNode(str(host.Dedicated).lower())
-            dedicated.appendChild(text)
-        if(host.GpuCount != None):
-            gpucount = doc.createElementNS(__MonitoringNS, "GPUCount")
-            containedResource.appendChild(gpucount)
-            gpucount.setAttribute("xmlns", __MonitoringNS)
-            text = doc.createTextNode(str(host.GpuCount).lower())
-            gpucount.appendChild(text)
-
-
-        usedCPUs = doc.createElementNS(__MonitoringNS, "UsedCPUCount")
-        containedResource.appendChild(usedCPUs)
-        usedCPUs.setAttribute("xmlns", __MonitoringNS)
-        text = doc.createTextNode(str(int(host.UsedCpuCount)))
-        usedCPUs.appendChild(text)
-       
+        if(host.TotalMemory == None):
+            raise ValueError("TotalMemory cannot be None")
+        physicalMemory = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":PhysicalMemory")
+        containedResource.appendChild(physicalMemory)
+        text = doc.createTextNode(str(int(host.TotalMemory)))
+        physicalMemory.appendChild(text)
+        
+        if(host.TotalSwap == None):
+            raise ValueError("TotalSwap cannot be None")
+        virtualMemory = doc.createElementNS(__BesFactoryNS, __BesFactoryNSPrefix + ":VirtualMemory")
+        containedResource.appendChild(virtualMemory)
+        text = doc.createTextNode(str(int(host.TotalSwap)))
+        virtualMemory.appendChild(text)
+        
+        if(host.CpuUtilization == None):
+            raise ValueError("CpuUtilization cannot be None")
+        utilization = doc.createElementNS(__MonitoringNS, "Utilization")
+        containedResource.appendChild(utilization)
+        utilization.setAttribute("xmlns", __MonitoringNS)
+        text = doc.createTextNode(str(int(host.CpuUtilization * 100)))
+        utilization.appendChild(text)
+        
     return doc
 
-def clusterMonitoringFromQueuesResAndJobs(queuesInfo, reservationsInfo, jobsInfo):
-    """Gets XML from list of QueueInfo and Job entities"""
+def clusterMonitoringFromQueuesAndRes(queuesInfo, reservationsInfo):
+    """Gets XML from list of QueueInfo and ReservationInfo entities"""
        
     doc = Document()
@@ -242,10 +150,6 @@
     queues = doc.createElementNS(__MonitoringNS, "Queues")
     cluster.appendChild(queues)
-    if os.getenv("QCG_DEFAULT_QUEUE") is not None:
-        default_queue = os.getenv("QCG_DEFAULT_QUEUE")
-    else:
-        default_queue = None
-    
-    for queueInfo in queuesInfo[0]:
+    
+    for queueInfo in queuesInfo:
         queue = doc.createElementNS(__MonitoringNS, "Queue")
         queue.setAttribute("name", queueInfo.QueueName)
@@ -253,27 +157,16 @@
             raise ValueError("Walltime must not be None")
         queue.setAttribute("walltime", __toXmlDuration(queueInfo.Walltime))
+        queue.setAttribute("default", str(queueInfo.IsDefault))
+        queue.setAttribute("priority", str(queueInfo.QueuePriority))
+        queue.setAttribute("maxJobs", str(queueInfo.MaxJobs))
         queue.setAttribute("runningJobs", str(queueInfo.RunningJobs))
         queue.setAttribute("waitingJobs", str(queueInfo.PendingJobs))
-        if queueInfo.Enabled is not None:
-            queue.setAttribute("enabled", str(queueInfo.Enabled).lower())
-        if queueInfo.Started is not None:
-            queue.setAttribute("started", str(queueInfo.Started).lower())
-        if default_queue is not None and default_queue == queueInfo.QueueName:
-            queue.setAttribute("default", "true")
         queues.appendChild(queue) 
     
-    jobs = doc.createElementNS(__MonitoringNS, "Jobs")
-    cluster.appendChild(jobs)
-
-    reservationsDict = dict()
-    #parse reservations Info
     reservations = doc.createElementNS(__MonitoringNS, "Reservations")
     cluster.appendChild(reservations)
-        
-    for reservationInfo in reservationsInfo[0]:
-        if reservationInfo.Type != "ar":
-            reservationsDict[reservationInfo.ReservationName] = reservationInfo
-            continue
-
+    
+    for reservationInfo in reservationsInfo:
+        
         reservation = doc.createElementNS(__MonitoringNS, "Reservation")
         reservation.setAttribute("name", reservationInfo.ReservationName)
@@ -283,73 +176,15 @@
         reservation.setAttribute("startTime", __toXmlDateTime(reservationInfo.StartTime))
         if reservationInfo.EndTime != None:
-           reservation.setAttribute("endTime", __toXmlDateTime(reservationInfo.EndTime))
-        if reservationInfo.Owner != None:	
-            reservation.setAttribute("owner", reservationInfo.Owner)
-
+            reservation.setAttribute("EndTime", __toXmlDateTime(reservationInfo.EndTime))
+        reservation.setAttribute("owner", reservationInfo.Owner)
         reservations.appendChild(reservation)
-
+        
         resources = reservationInfo.Resources
         for resourceKey in resources.keys():
-            resource = doc.createElementNS(__MonitoringNS, "Host")
+            resource = doc.createElementNS(__MonitoringNS, "Resource")
             resource.setAttribute("name", resourceKey)
-            if resources[resourceKey] is not None:
-                resource.setAttribute("slots", str(resources[resourceKey]))
+            resource.setAttribute("reservedSlots", str(resources[resourceKey]))
             reservation.appendChild(resource)
-
-        reservations.appendChild(reservation)
-
-          
-    for jobInfo in jobsInfo[0]:
-        
-        job = doc.createElementNS(__FactoryNS, "Job")
-        job.setAttribute("name", jobInfo.JobName)
-        job.setAttribute("id", jobInfo.JobID)
-        job.setAttribute("queue", jobInfo.QueueName)
-        if jobInfo.SubmissionTime != None:
-            job.setAttribute("submissionTime", __toXmlDateTime(jobInfo.SubmissionTime))
-        job.setAttribute("owner", jobInfo.OwnerName)
-
-        if jobInfo.StartTime != None:
-            job.setAttribute("startTime", __toXmlDateTime(jobInfo.StartTime))
-        elif jobInfo.JobID in reservationsDict:
-            job.setAttribute("estStartTime", __toXmlDateTime(reservationsDict[jobInfo.JobID].StartTime))
-
-        if jobInfo.EndTime != None:
-            job.setAttribute("endTime", __toXmlDateTime(jobInfo.EndTime))
-        elif jobInfo.JobID in reservationsDict:
-            job.setAttribute("estEndTime", __toXmlDateTime(reservationsDict[jobInfo.JobID].EndTime))
-
-        if jobInfo.TotalCores != None:
-            job.setAttribute("cores", str(jobInfo.TotalCores))
-
-        if jobInfo.CpuTime != None:
-            job.setAttribute("cpuTime", str(jobInfo.CpuTime))
-
-        if jobInfo.MemUsage != None:
-            job.setAttribute("memUsage", str(jobInfo.MemUsage))
-
-        if jobInfo.Description != None:
-            job.setAttribute("desc", jobInfo.Description)
-
-        if jobInfo.ReservationID != None:
-            job.setAttribute("resId", jobInfo.ReservationID)
-
-        if len(jobInfo.ExecutionHosts) != 0:
-            eHosts = jobInfo.ExecutionHosts
-            for ehost in eHosts.keys():
-                host = doc.createElementNS(__MonitoringNS, "Host")
-                host.setAttribute("name", ehost)
-                if eHosts[ehost] is not None:
-                    host.setAttribute("slots", str(eHosts[ehost]))
-                job.appendChild(host)
-        elif jobInfo.JobID in reservationsDict:
-            rHosts = reservationsDict[jobInfo.JobID].Resources
-            for rhost in rHosts.keys():
-                host = doc.createElementNS(__MonitoringNS, "Host")
-                host.setAttribute("name", rhost)
-                if rHosts[rhost] is not None:
-                    host.setAttribute("slots", str(rHosts[rhost]))
-                job.appendChild(host)
-        jobs.appendChild(job)
+        
     return doc
 
@@ -359,99 +194,33 @@
 
 _cap_map = grid_monitoring.monitoringCapabilities()
+for i in _cap_map.keys():
+    if _cap_map[i]:
+        info("grid_monitoring reports " + i + " as available")
+    else:
+        info("grid_monitoring reports " + i + " as not available")
 
 class MonitoringDRMS(Module):
     
     def __init__(self, *unused):
-        signal_connect("smc_factory_attributes", self.factory_attr_handler)
+        #signal_connect("smc_factory_attributes", self.factory_attr_handler)
         signal_connect("smc_contained_resources", self.contained_resources_handler)
-        signal_connect("smc_jobs_info", self.jobs_info_handler)
+        #signal_connect("smc_job_info", self.job_info_handler)
 
     def factory_attr_handler(self, signal, drms_type, unused):
+        queuesInfo = grid_monitoring.getQueueData(drms_type, None)
+        reservationsInfo = grid_monitoring.getReservationData(drms_type, None)
+        doc = clusterMonitoringFromQueuesAndRes(queuesInfo, reservationsInfo)                
+        return removeXmlHeader(doc.toxml()) 
+            
+    def contained_resources_handler(self, signal, drms_type, unused):
+        hostsInfo = grid_monitoring.getHostData(drms_type, None)
+        doc = containedResourcesFromHostInfos(hostsInfo)                  
+        return removeXmlHeader(doc.toxml())
+                                
+    def job_info_handler(self, signal, drms_type, job_id, unused):
         try:
-            queuesInfo = grid_monitoring.getQueueData(drms_type)
-            try:
-                reservationsInfo = grid_monitoring.getReservationData(drms_type)
-            except:
-                error("getReservationData failed: " + str(sys.exc_info()[0]))
-                reservationsInfo = ([], dict()) #continue - provding info about reservations is not so crucial
-            
-            jobsInfo = grid_monitoring.getJobData(drms_type)
-            doc = clusterMonitoringFromQueuesResAndJobs(queuesInfo, reservationsInfo, jobsInfo)
-            result = removeXmlHeader(doc.toxml())
-            doc.unlink()
-            return result
-        except GMError, e:
-            error("Failed to get factory attr: " + str(e))
-            signal.stop_emission();
-    
-    def contained_resources_handler(self, signal, drms_type, unused):
-        try:
-            hostsInfo = grid_monitoring.getHostData(drms_type)
-            doc = containedResourcesFromHostInfos(hostsInfo)                  
-            result = removeXmlHeader(doc.toxml())
-            doc.unlink()
-            return result
-        except GMError, e:
-            error("Failed to get contained resources attr: " + str(e))
-            signal.stop_emission();
-    
-    def jobs_info_handler(self, signal, drms_type, job_ids, extended, unused):
-        try:
-            debug("job_ids = " + str(job_ids) + " extended = " + str(extended))
-            #get basic data for all jobs (this information is cached so it costs nothing)
-            jobInfos = grid_monitoring.getJobData(drms_type)
-            #construct subset of jobs you we are especially interested in
-            job_ids_subset = []
-            users_jobs_count_map = dict()
-            for jobInfo in asList(jobInfos): #we are iterating over jobInfos not jobId beacuse jobInfos should maintain job priority
-                if jobInfo.JobID not in job_ids:
-                   continue
-                #job submitted within last 5-15m
-                if jobInfo.SubmissionTime is not None:
-                     since_submission = datetime.datetime.now() - jobInfo.SubmissionTime
-                else:
-                     since_submission = None
-
-                if since_submission is not None and \
-                     since_submission  >  timedelta(minutes=5) and \
-                     since_submission  <  timedelta(minutes=15):
-                     pass
-                elif not extended: #this litmits frequency
-                    continue
-
-                if jobInfo.JobStatus != "Pending": #TODO in the future we may need to keep separate list for running/pending jobs
-                    continue                 
-
-                #golden fish can tell you only about 3 jobs
-                if jobInfo.OwnerName in users_jobs_count_map:
-                    if users_jobs_count_map[jobInfo.OwnerName] >= 3:
-                        continue
-                    users_jobs_count_map[jobInfo.OwnerName] = users_jobs_count_map[jobInfo.OwnerName] + 1  
-                else:
-                    users_jobs_count_map[jobInfo.OwnerName] = 1
-                #and the lucky job_id is...
-                job_ids_subset.append(jobInfo.JobID)
-
-            #safet valve
-            job_ids_subset = job_ids_subset[:30]
-            info("Jobs selected for extended query: " + str(job_ids_subset))
-
-            try:
-                grid_monitoring.addExtendedJobData(drms_type, job_ids_subset, job_ids)
-            except: #be on safe side
-                error("Failed to get extended job information")
-          
-            #create xml documents, one for each job
-            responses = []
-            for job_id in job_ids:
-                if job_id in asDict(jobInfos):
-                    doc = jobMonitoringXmlFromJobInfo(asDict(jobInfos)[job_id])
-                    responses.append(removeXmlHeader(doc.toxml()))
-                    doc.unlink()
-                else: # job may be terminated already
-                    debug("Job " + job_id + " already terminated")
-                    responses.append("")
-
-            return [responses]
+            jobInfo = grid_monitoring.getJobData(drms_type, [job_id])[0]
+            doc = jobMonitoringXmlFromJobInfo(jobInfo)
+            return removeXmlHeader(doc.toxml())           
         except GMUnknowJob:
             return ""
Index: trunk/src/xmlstructs/jsdl-qcg-comp-ares.xsd
===================================================================
--- trunk/src/xmlstructs/jsdl-qcg-comp-ares.xsd	(revision 2)
+++ trunk/src/xmlstructs/jsdl-qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../schemas/interface/jsdl-qcg-comp-ares.xsd
+link ../../schemas/interface/jsdl-smoa-comp-ares.xsd
Index: trunk/src/xmlstructs/jsdl-qcg-comp-staging.xsd
===================================================================
--- trunk/src/xmlstructs/jsdl-qcg-comp-staging.xsd	(revision 2)
+++ trunk/src/xmlstructs/jsdl-qcg-comp-staging.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../schemas/interface/jsdl-qcg-comp-staging.xsd
+link ../../schemas/interface/jsdl-smoa-comp-staging.xsd
Index: trunk/src/xmlstructs/qcg-comp-factory.xsd
===================================================================
--- trunk/src/xmlstructs/qcg-comp-factory.xsd	(revision 2)
+++ trunk/src/xmlstructs/qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../schemas/interface/qcg-comp-factory.xsd
+link ../../schemas/interface/smoa-comp-factory.xsd
Index: trunk/src/xmlstructs/xmlstructs_test.c
===================================================================
--- trunk/src/xmlstructs/xmlstructs_test.c	(revision 338)
+++ trunk/src/xmlstructs/xmlstructs_test.c	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #include <qcg-core/sm.h>
Index: trunk/src/xmlstructs/Makefile.am
===================================================================
--- trunk/src/xmlstructs/Makefile.am	(revision 157)
+++ trunk/src/xmlstructs/Makefile.am	(revision 1)
@@ -7,6 +7,7 @@
 		   stub/xmlstructs.gsoap \
 		   stub/xmlstructsH.h \
-		   stub/xmlstructsStub.h \
-		   stub/xmlstructs.nsmap
+		   stub/xmlstructs.nsmap \
+		   stub/xmlstructsServer.c \
+		   stub/xmlstructsStub.h
 
 $(GSOAP_GEN_SOURCE):
@@ -20,5 +21,5 @@
 	     ardl.xsd bes-factory.xsd qcg-comp-ares.xsd qcg-comp-factory.xsd \
 	     hpcp-fs.xsd jsdl-qcg-comp-ares.xsd jsdl-qcg-comp-factory.xsd \
-	     jsdl-hpcpa.xsd jsdl.xsd qcg-comp-monitoring.xsd
+	     jsdl-hpcpa.xsd jsdl.xsd
 
 if DEVELOPER_MODE
Index: trunk/src/xmlstructs/qcg-comp-ares.xsd
===================================================================
--- trunk/src/xmlstructs/qcg-comp-ares.xsd	(revision 2)
+++ trunk/src/xmlstructs/qcg-comp-ares.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../schemas/interface/qcg-comp-ares.xsd
+link ../../schemas/interface/smoa-comp-ares.xsd
Index: trunk/src/xmlstructs/xmlstructs.h
===================================================================
--- trunk/src/xmlstructs/xmlstructs.h	(revision 338)
+++ trunk/src/xmlstructs/xmlstructs.h	(revision 1)
@@ -2,25 +2,18 @@
 
 /*
- * QosCosGrid Computing
- * Copyright (C) 2008-2012 Poznan Supercomputing and Networking Center
+ * Copyright 2006-2009 QCG Project Team
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- * This program is released under the GPL with the additional exemption that
- * compiling, linking, and/or using OpenSSL is allowed.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-
-
 
 #ifndef __SMC_XMLSTRUCTS_H
Index: trunk/src/xmlstructs/jsdl-qcg-comp-factory.xsd
===================================================================
--- trunk/src/xmlstructs/jsdl-qcg-comp-factory.xsd	(revision 2)
+++ trunk/src/xmlstructs/jsdl-qcg-comp-factory.xsd	(revision 1)
@@ -1,1 +1,1 @@
-link ../../schemas/interface/jsdl-qcg-comp-factory.xsd
+link ../../schemas/interface/jsdl-smoa-comp-factory.xsd
Index: trunk/src/xmlstructs/qcg-comp-monitoring.xsd
===================================================================
--- trunk/src/xmlstructs/qcg-comp-monitoring.xsd	(revision 60)
+++ 	(revision )
@@ -1,1 +1,0 @@
-link ../../schemas/interface/qcg-comp-monitoring.xsd
Index: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	(revision 339)
+++ trunk/Makefile.am	(revision 1)
@@ -10,7 +10,5 @@
 	     autoclean.sh \
 	     autogen.sh \
-	     LICENSE \
-	     LICENSE.GPL \
-		 LICENSE.OpenSSL
+	     LICENSE 
 
 dist-hook:
Index: trunk/makeDist.sh
===================================================================
--- trunk/makeDist.sh	(revision 548)
+++ trunk/makeDist.sh	(revision 1)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
-
-QCG_COMP_VERSION="2.6.5"
+QCG_COMP_VERSION="2.2.2"
 QCG_COMP_NAME="qcg-comp"
 
@@ -12,13 +11,13 @@
 rm -rf $QCG_DIST_DIR*
 
-make clean all
+#make clean all
 
 svn stat
 
-sed -ibak s/DEVELOPER_MODE=\"yes\"/DEVELOPER_MODE=\"no\"/ configure.ac  
+sed -i .bak s/DEVELOPER_MODE=\"yes\"/DEVELOPER_MODE=\"no\"/ configure.ac  
 
 make dist
 
-sed -ibak s/DEVELOPER_MODE=\"no\"/DEVELOPER_MODE=\"yes\"/ configure.ac  
+sed -i bak s/DEVELOPER_MODE=\"no\"/DEVELOPER_MODE=\"yes\"/ configure.ac  
 
 tar -xzf $QCG_DIST_FILE
Index: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh	(revision 153)
+++ trunk/autogen.sh	(revision 1)
@@ -1,19 +1,19 @@
 #!/bin/sh
 #
-# QosCosGrid Computing
-# Copyright (C) 2008-2011 Poznan Supercomputing and Networking Center
+# $Id: autogen.sh 2312 2009-04-15 17:31:24Z mmamonski $
 #
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# Copyright 2006-2009 QCG Project Team
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
 #
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 
Index: trunk/etc/Makefile.am
===================================================================
--- trunk/etc/Makefile.am	(revision 643)
+++ trunk/etc/Makefile.am	(revision 1)
@@ -5,5 +5,7 @@
 SUBST_FILES = \
 		qcg-compd.xml \
+		qcg-compd-plgrid.xml \
 		qcg-comp.xml \
+		qcg-comp-plgrid.xml \
 		qcg-coordinatord.xml \
 		qcg-coordinator.xml
Index: trunk/etc/qcg-comp-plgrid.xml.in
===================================================================
--- trunk/etc/qcg-comp-plgrid.xml.in	(revision 1)
+++ trunk/etc/qcg-comp-plgrid.xml.in	(revision 1)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sm:QCGCore
+	xmlns:sm="http://schemas.qoscosgrid.org/core/2011/04/config"
+	xmlns="http://schemas.qoscosgrid.org/comp/2011/04/config"
+	xmlns:smc="http://schemas.qoscosgrid.org/comp/2011/04/config"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	
+	<Configuration>
+		<sm:ModuleManager>
+			<sm:Directory>@QCG_CORE_DIR_MODULEEXEC@/</sm:Directory>
+			<sm:Directory>@QCG_COMP_DIR_MODULEEXEC@/</sm:Directory>
+		</sm:ModuleManager>
+
+		<sm:Client xsi:type="qcg-comp" description="QCG Computing client">
+			<sm:Transport>
+				<sm:Module xsi:type="sm:ecm_gsoap.client">
+					<sm:ServiceURL>httpg://localhost:19000/</sm:ServiceURL>
+					<sm:Authentication>
+						<sm:Module xsi:type="sm:atc_transport_gsi.client"/>
+					</sm:Authentication>
+					<sm:Module xsi:type="smc:qcg-comp-client"/>
+				</sm:Module>
+			</sm:Transport>
+		</sm:Client>
+	</Configuration>
+</sm:QCGCore>
+<!-- vim: set ts=2 sw=2: -->
Index: trunk/etc/qcg-comp.xml.in
===================================================================
--- trunk/etc/qcg-comp.xml.in	(revision 643)
+++ trunk/etc/qcg-comp.xml.in	(revision 1)
@@ -15,7 +15,7 @@
 			<sm:Transport>
 				<sm:Module xsi:type="sm:ecm_gsoap.client">
-					<sm:ServiceURL>httpg://frontend.example.com:19000/</sm:ServiceURL>
+					<sm:ServiceURL>http://localhost:19000/</sm:ServiceURL>
 					<sm:Authentication>
-						<sm:Module xsi:type="sm:atc_transport_gsi.client"/>
+						<sm:Module xsi:type="sm:atc_transport_http.client"/>
 					</sm:Authentication>
 					<sm:Module xsi:type="smc:qcg-comp-client"/>
Index: trunk/etc/qcg-compd-plgrid.xml.in
===================================================================
--- trunk/etc/qcg-compd-plgrid.xml.in	(revision 1)
+++ trunk/etc/qcg-compd-plgrid.xml.in	(revision 1)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sm:QCGCore
+	xmlns:sm="http://schemas.qoscosgrid.org/core/2011/04/config"
+	xmlns="http://schemas.qoscosgrid.org/comp/2011/04/config"
+	xmlns:smc="http://schemas.qoscosgrid.org/comp/2011/04/config"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	
+	<Configuration>
+		<sm:ModuleManager>
+			<sm:Directory>@QCG_CORE_DIR_MODULEEXEC@/</sm:Directory>
+			<sm:Directory>@QCG_COMP_DIR_MODULEEXEC@/</sm:Directory>
+		</sm:ModuleManager>
+
+		<sm:Service xsi:type="qcg-compd" description="QCG Computing">
+			<sm:Logger>
+				<sm:Filename>@QCG_COMP_DIR_LOCALSTATE@/log/qcg-comp/qcg-compd.log</sm:Filename>
+				<sm:Level>INFO</sm:Level>
+			</sm:Logger>
+
+			<sm:Transport>
+				<sm:Module xsi:type="sm:ecm_gsoap.service">
+						<sm:Host>frontend.example.com</sm:Host>
+						<sm:Port>19000</sm:Port>
+						<sm:KeepAlive>false</sm:KeepAlive>
+						<sm:Authentication>
+								<sm:Module xsi:type="sm:atc_transport_gsi.service">
+										<sm:X509CertFile>/opt/plgrid/qcg/qcg/etc/certs/qcgcert.pem</sm:X509CertFile>
+										<sm:X509KeyFile>/opt/plgrid/qcg/qcg/etc/certs/qcgkey.pem</sm:X509KeyFile>
+								</sm:Module>
+						</sm:Authentication>
+						<sm:Authorization>
+								<sm:Module xsi:type="sm:atz_mapfile">
+										<sm:Mapfile>/etc/grid-security/grid-mapfile</sm:Mapfile>
+								</sm:Module>
+						</sm:Authorization>
+				</sm:Module>
+				<sm:Module xsi:type="smc:qcg-comp-service"/>
+			</sm:Transport>
+			
+			<sm:Module xsi:type="pbs_jsdl_filter"/>
+			<sm:Module xsi:type="atz_ardl_filter"/>
+			<sm:Module xsi:type="sm:general_python" path="/opt/plgrid/qcg/qcg/lib/qcg-comp/modules/python/monitoring.py"/>
+
+			<sm:Module xsi:type="submission_drmaa" path="/opt/plgrid/qcg/qcg/lib/libdrmaa.so"/>
+			<sm:Module xsi:type="reservation_python" path="@QCG_COMP_DIR_MODULEEXEC@/python/reservation_maui.py"/>
+			
+			<sm:Module xsi:type="notification_wsn">
+				<sm:Module xsi:type="sm:ecm_gsoap.client">
+						<sm:ServiceURL>http://localhost:19001/</sm:ServiceURL>
+							<sm:Authentication>
+								<sm:Module xsi:type="sm:atc_transport_http.client"/>
+							</sm:Authentication>
+						<sm:Module xsi:type="sm:ntf_client"/>
+				</sm:Module>
+			</sm:Module>
+				
+			<sm:Module xsi:type="application_mapper">
+				<ApplicationMapFile>@QCG_COMP_DIR_SYSCONF@/application_mapfile</ApplicationMapFile>
+			</sm:Module>
+
+			<Database>
+				<DSN>qcg_comp</DSN>
+				<User>qcg_comp</User>
+				<Password>qcg_comp</Password>
+			</Database>
+
+			<UnprivilegedUser>qcg_comp</UnprivilegedUser>
+
+			<FactoryAttributes>
+				<CommonName>klaster.plgrid.pl</CommonName>
+				<LongDescription>PL-Grid cluster</LongDescription>
+			</FactoryAttributes>
+		</sm:Service>
+	</Configuration>
+</sm:QCGCore>
+<!-- vim: set ts=2 sw=2: -->
Index: trunk/etc/qcg-compd.xml.in
===================================================================
--- trunk/etc/qcg-compd.xml.in	(revision 1180)
+++ trunk/etc/qcg-compd.xml.in	(revision 1)
@@ -13,7 +13,6 @@
 
 		<sm:Service xsi:type="qcg-compd" description="QCG Computing">
-      <sm:WorkingDirectory>@QCG_COMP_DIR_LOCALSTATE@/log/qcg/qcg-comp/</sm:WorkingDirectory>
 			<sm:Logger>
-				<sm:Filename>@QCG_COMP_DIR_LOCALSTATE@/log/qcg/qcg-comp/qcg-compd.log</sm:Filename>
+				<sm:Filename>@QCG_COMP_DIR_LOCALSTATE@/log/qcg-comp/qcg-compd.log</sm:Filename>
 				<sm:Level>INFO</sm:Level>
 			</sm:Logger>
@@ -21,35 +20,39 @@
 			<sm:Transport>
 				<sm:Module xsi:type="sm:ecm_gsoap.service">
-						<sm:Host>frontend.example.com</sm:Host>
-						<sm:Port>19000</sm:Port>
-						<sm:KeepAlive>false</sm:KeepAlive>
-						<sm:Authentication>
-								<sm:Module xsi:type="sm:atc_transport_gsi.service">
-										<sm:X509CertFile>/etc/grid-security/hostcert.pem</sm:X509CertFile>
-										<sm:X509KeyFile>/etc/grid-security/hostkey.pem</sm:X509KeyFile>
-								</sm:Module>
-						</sm:Authentication>
-						<sm:Authorization>
-								<sm:Module xsi:type="sm:atz_mapfile">
-										<sm:Mapfile>/etc/grid-security/grid-mapfile</sm:Mapfile>
-								</sm:Module>
-						</sm:Authorization>
+					<sm:Host>localhost</sm:Host>
+					<sm:Port>19000</sm:Port>
 				</sm:Module>
 				<sm:Module xsi:type="smc:qcg-comp-service"/>
 			</sm:Transport>
 			
-			<sm:Module xsi:type="pbs_jsdl_filter"/>
-			<sm:Module xsi:type="atz_ardl_filter"/>
+			<sm:Authentication>
+				<sm:Module xsi:type="sm:atc_transport_http.service"/>
+			</sm:Authentication>
 
-			<sm:Module xsi:type="sm:general_python" path="/usr/lib64/qcg-comp/modules/python/monitoring.py"/>
-      <sm:Module xsi:type="sm:general_python" path="/usr/lib64/qcg-comp/modules/python/modules_info.py"/>
-      <!--sm:Module xsi:type="sm:general_python" path="/usr/lib64/qcg-comp/modules/python/plgrid_info.py"/ this module is Mandatory in  PL-Grid-->
+			<sm:Authorization>
+				<sm:Module xsi:type="sm:atz_anonymous">
+					<sm:MappedUser>nobody</sm:MappedUser>
+				</sm:Module>
+			</sm:Authorization>
 
-			<sm:Module xsi:type="submission_drmaa" path="/opt/qcg/dependencies/lib/libdrmaa.so"/>
-			<!--sm:Module xsi:type="reservation_python" path="@QCG_COMP_DIR_MODULEEXEC@/python/reservation_maui.py"/-->
+			<sm:Module xsi:type="submission_drmaa" path="/usr/local/lib/libdrmaa.so"/>
+			<!--sm:Module xsi:type="reservation_ares" path="/usr/local/lib/libares.so"/-->
+			<!--sm:Module xsi:type="reservation_python" path="@QCG_COMP_DIR_MODULEEXEC@/python/reservation_sge.py"/-->
+
+			<!-- Enable this if you have libcurl support compiled in
+			<sm:Module xsi:type="staging_curl"/>
+			-->
+
+			<!-- Example usage of JSDL filter Python script
+			<sm:Module xsi:type="sm:general_python" path="@QCG_COMP_DIR_MODULEEXEC@/python/jsdl_filter.py"/>
+			-->
+
+			<!-- Example usage of FactoryAttributes provider Python script
+			<sm:Module xsi:type="sm:general_python" path="@QCG_COMP_DIR_MODULEEXEC@/python/factory_attr.py"/>
+			-->
 			
-			<sm:Module xsi:type="notification_wsn">
-				<sm:Module xsi:type="sm:ecm_gsoap.client">
-						<sm:ServiceURL>http://frontend.example.com:19001/</sm:ServiceURL>
+			<!--sm:Module xsi:type="notification_wsn">
+				<sm:Module xsi:type="sm:ecm_gsoap.client" >
+						<sm:ServiceURL>http://localhost:19001/</sm:ServiceURL>
 							<sm:Authentication>
 								<sm:Module xsi:type="sm:atc_transport_http.client"/>
@@ -57,5 +60,5 @@
 						<sm:Module xsi:type="sm:ntf_client"/>
 				</sm:Module>
-			</sm:Module>
+			</sm:Module-->
 				
 			<sm:Module xsi:type="application_mapper">
@@ -64,16 +67,36 @@
 
 			<Database>
-				<DSN>qcg-comp</DSN>
-				<User>qcg-comp</User>
-				<Password>qcg-comp</Password>
+				<DSN>qcg_comp</DSN>
+				<User>qcg_comp</User>
+				<Password>qcg_comp</Password>
 			</Database>
 
-			<UnprivilegedUser>qcg-comp</UnprivilegedUser>
+			<UnprivilegedUser>nobody</UnprivilegedUser>
 
 			<FactoryAttributes>
-				<CommonName>hpc.example.com</CommonName>
-				<LongDescription>QCG enabled cluster</LongDescription>
+				<CommonName>IT cluster</CommonName>
+				<LongDescription>IT department cluster for public use</LongDescription>
+				<ContainedResources xmlns:bes-factory="http://schemas.ggf.org/bes/2006/08/bes-factory" xmlns:jsdl="http://schemas.ggf.org/jsdl/2005/11/jsdl">
+					<ContainedResource>
+						<bes-factory:ResourceName>alpha.example.com</bes-factory:ResourceName>
+						<bes-factory:CPUArchitecture>
+							<jsdl:CPUArchitectureName>x86_64</jsdl:CPUArchitectureName>
+						</bes-factory:CPUArchitecture>
+						<bes-factory:CPUCount>4</bes-factory:CPUCount>
+						<bes-factory:PhysicalMemory>1073741824</bes-factory:PhysicalMemory>
+					</ContainedResource>
+					<ContainedResource>
+						<bes-factory:ResourceName>beta.example.com</bes-factory:ResourceName>
+						<bes-factory:CPUArchitecture>
+							<jsdl:CPUArchitectureName>x86_64</jsdl:CPUArchitectureName>
+						</bes-factory:CPUArchitecture>
+						<bes-factory:CPUCount>2</bes-factory:CPUCount>
+						<bes-factory:PhysicalMemory>1073741824</bes-factory:PhysicalMemory>
+					</ContainedResource>
+				</ContainedResources>
+				<example:AdministratorEmail xmlns:example="http://example.com">admin@example.com</example:AdministratorEmail>
 			</FactoryAttributes>
 		</sm:Service>
+
 	</Configuration>
 </sm:QCGCore>
Index: trunk/etc/application_mapfile
===================================================================
--- trunk/etc/application_mapfile	(revision 596)
+++ trunk/etc/application_mapfile	(revision 1)
@@ -1,4 +1,5 @@
 # ApplicationName ApplicationVersion Executable
 
-bash * /opt/exp_soft/qcg/qcg-app-scripts/app-scripts/bash.qcg
-
+date * /bin/date
+LPSolve 5.5 /usr/local/bin/lp_solve
+QCG-OMPI /opt/QCG/qcg/share/qcg-comp/tools/cross-mpi.starter
Index: trunk/etc/qcg-coordinatord.xml.in
===================================================================
--- trunk/etc/qcg-coordinatord.xml.in	(revision 585)
+++ trunk/etc/qcg-coordinatord.xml.in	(revision 1)
@@ -14,5 +14,5 @@
 		<sm:Service xsi:type="qcg-coordinatord" description="QCG Computing Coordinator">
 			<sm:Logger>
-				<sm:Filename>@QCG_COMP_DIR_LOCALSTATE@/log/qcg-comp/qcg-coordinatord.log</sm:Filename>
+				<sm:Filename>@QCG_COMP_DIR_LOCALSTATE@/log/qcg-comp/qcg-coordinator.log</sm:Filename>
 				<sm:Level>INFO</sm:Level>
 			</sm:Logger>
@@ -30,5 +30,7 @@
 			</sm:Authentication>
 			<sm:Module xsi:type="sm:ecm_gsoap.client">
-				<sm:ServiceURL>http://localhost:19003/</sm:ServiceURL>
+				<sm:Host>localhost</sm:Host>
+				<sm:Port>19100</sm:Port>
+				<sm:UseWSA>false</sm:UseWSA>
 				<sm:Authentication>
 					<sm:Module xsi:type="sm:atc_transport_http.client"/>
Index: trunk/check_mem.sh
===================================================================
--- trunk/check_mem.sh	(revision 245)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-
-egrep -n  -R '(sm_[rmc]alloc)' src/ | grep -v svn | grep -v Bin | grep -v TRY_NOT | grep -v if | grep -v CHECK
Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 1180)
+++ 	(revision )
@@ -1,98 +1,0 @@
-********************************
-* QCG-Computing Changelog File *
-********************************
-
-== 4.0 [Feb 2016] ==
-* Licenses handling (SLURM)
-* Case insensitive in application names
-* Improvements in PBS Pro handling  
-* Support for GPU resources
-* Bug fixes
-
-== 3.4.0 [Sep June 2014] ==
-* Third UMD release
-* Updated Java SDK to use JGlobus 2.0.8
-* Created RPM package for application scripts (qcg-appscripts)
-* PBS reservations: ReservationName not supported, instead Project is supported 
-* Torque: improved grid host monitoring handling
-* Bug fixes
-
-== 3.2.1 [10 March 2014] ==
-* Logging an address on which the service is listening.
-
-== 3.2.0 [Nov 2013] ==
-* Second UMD release
-* Performance optimization of the GetFactoryAttributes method
-* GPUSCount extension element in SLURM module
-* Bug fixes
-
-== 3.0.4 [July 2013] ==
-* First UMD release
-* Bug fixes
-
-== 3.0.4 [July 2013] ==
-* First UMD release
-* Bug fixes
-* sanity check of SPECs file.
-
-== 3.0.3 [15 May 2013] ==
-* Integration with VOMS
-* Generation of factory attributes document in session process
-* Privileged ports
-* Extended job statistics (Estimated start time, memory and cpu usage)
-* Proper handling of cancelled state
-* Disable submission
-* Bug fixes
-
-== 2.6.4 [19 Oct 2012 ] ==
-* Better integration with SLURM (monitoring and JSDL filter modules)
-* More verbose sample daemon configuration
-
-== 2.6.3 [19 July 2012 ] ==
-* Advance Reservation and TotalCPUCount support is now discoverable
-* In session process database is queried only upon job state change
-* Walltime of jobs submitted into Advance Reservation is truncated to reservation duration
-* Added mechanism for  "orphaned" jobs handling.
-* IBM !LoadLeveler support
-
-== 2.6.2 [28 May 2012] ==
-* Fixed `UsedSlotsCount` in getFactoryAttributeDocument
-* Added node filetering feature (QCG_NODE_FILTER)
-* Auto creation of working directory
-
-== 2.6.1 [16 April 2012] ==
-* Minor security fixes
-* SLURM reservation module
-
-== 2.4.1 ==
-* Support for max read chunk attribute in !StageOut operation
-* JavaSDK use now long for !MaxTotalMemory, File Offset and Size
-
-== 2.4.0 ==
-* PL-Grid information module
-* Modules information module
-* Storing information about reserved nodes in database
-
-== 2.2.7 ==
-* new environment configuration variable QCG_GE_PE_NAME
-* support for submitting jobs into local reservations
-
-== 2.2.6 ==
-* Advance Reservation module for PBS Pro
-* Advance Reservation module for Moab
-
-== 2.2.5 ==
-* caching of monitoring data (default information lifetime: 5 minutes) - reduce overhead on DRM systems
-* application map file is reloaded on every !GetFactoryAttributes call - no need to reastart service after registering a new application
-
-== 2.2.4 ==
-* first !QosCosGrid release
-* improved monitoring
-
-== 2.2.3 ==
-* fixes in Torque monitoring module (now nodes that are //down// are treated properly)
-* service log file is named `smoa-compd.log` instead of `smoa-comp.log` 
-* RPM set read rights to logs and configuration file to the `smoa_dev` system group. 
-
-== 2.2.2 ==
-* getFactoryAttributes returns now list of authorized DNs
Index: trunk/RELEASE_NOTES
===================================================================
--- trunk/RELEASE_NOTES	(revision 1180)
+++ 	(revision )
@@ -1,21 +1,0 @@
-*******************************
-* QCG-Computing Release Notes *
-*******************************
-
-== 4.0 [Feb 2016] ==
-* Licenses handling (SLURM)
-* Case insensitive in application names
-* Improvements in PBS Pro handling  
-* Support for GPU resources
-* Bug fixes
-
-== 3.4.0.26 [June 2015] ==
-* Unicode JSDL descriptions bugfix
-
-== 3.4.0 [Sep 2014] ==
-* Third UMD release
-* Updated Java SDK to use JGlobus 2.0.8
-* Created RPM package for application scripts (qcg-appscripts)
-* PBS reservations: ReservationName not supported, instead Project is supported 
-* Torque: improved grid host monitoring handling
-* Bug fixes
Index: trunk/.ignore
===================================================================
--- trunk/.ignore	(revision 64)
+++ 	(revision )
@@ -1,69 +1,0 @@
-configure
-Makefile.in
-config.log
-config.status
-scripts
-stamp-h1
-config.h
-config.h.in
-libtool
-autom4te.cache
-aclocal.m4
-Makefile
-Makefile.in
-ardl.xsd
-jsdl-hpcpa.xsd
-jsdl-qcg-comp-ares.xsd
-bes-factory.wsdl
-hpcp-bp.xsd
-jsdl-qcg-comp-staging.xsd
-jsdl.xsd
-bes-management.wsdl
-qcg-comp-ares.xsd
-hpcp-fs.xsd
-qcg-comp-socks.wsdl
-jsdl-qcg-comp-factory.xsd
-qcg-comp-ares.wsdl
-qcg-comp-staging.wsdl
-qcg-comp-factory.xsd
-qcg-comp-rsync.wsdl
-qcg-coordinatord
-.deps
-qcg-compd
-qcg-comp
-qcg-comp-install.sh
-qcg-comp-plgrid.xml
-qcg-compd-plgrid.xml
-qcg-coordinator.xml
-qcg-coordinatord.xml
-qcg-comp.xml
-qcg-compd.xml
-target
-cross-mpi.conf
-stub
-qcg-comp.xsd
-qcg-coordinator
-ltsugar.m4
-libtool.m4
-ltversion.m4
-lt~obsolete.m4
-ltoptions.m4
-archive-tmp
-surefire-reports
-maven-archiver
-test-classes
-classes
-.project
-.cproject
-truststore.jks
-bat.pem
-keystore.p12
-hostkey.pem
-bat2.pem
-privkey.pem
-hostcert.pem
-bat.cert.der
-hostname
-surefire
-clientQCG.ks
-
Index: trunk/LICENSE.GPL
===================================================================
--- trunk/LICENSE.GPL	(revision 337)
+++ 	(revision )
@@ -1,676 +1,0 @@
-$Id: LICENSE 3 2010-11-26 17:07:13Z bartek $
-
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Index: trunk/LICENSE.OpenSSL
===================================================================
--- trunk/LICENSE.OpenSSL	(revision 337)
+++ 	(revision )
@@ -1,125 +1,0 @@
-  LICENSE ISSUES
-  ==============
-
-  The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
-  the OpenSSL License and the original SSLeay license apply to the toolkit.
-  See below for the actual license texts. Actually both licenses are BSD-style
-  Open Source licenses. In case of any license issues related to OpenSSL
-  please contact openssl-core@openssl.org.
-
-  OpenSSL License
-  ---------------
-
-/* ====================================================================
- * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- *    software must display the following acknowledgment:
- *    "This product includes software developed by the OpenSSL Project
- *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- *    endorse or promote products derived from this software without
- *    prior written permission. For written permission, please contact
- *    openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- *    nor may "OpenSSL" appear in their names without prior written
- *    permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- *    acknowledgment:
- *    "This product includes software developed by the OpenSSL Project
- *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
- Original SSLeay License
- -----------------------
-
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
