Index: trunk/Monitoring/smon/repo_io.py
===================================================================
--- trunk/Monitoring/smon/repo_io.py	(revision 859)
+++ trunk/Monitoring/smon/repo_io.py	(revision 859)
@@ -0,0 +1,130 @@
+# -*- coding: ISO-8859-1 -*-
+
+##################################
+#  @program        smon
+#  @description    simulation monitor
+#  @copyright      Copyright â(c)2009 Centre National de la Recherche Scientifique CNRS. 
+#                             All Rights Reservedâ
+#  @svn_file       $Id: repo_io.py 2599 2013-03-24 19:01:23Z jripsl $
+#  @version        $Rev: 2599 $
+#  @lastrevision   $Date: 2013-03-24 20:01:23 +0100 (Sun, 24 Mar 2013) $
+#  @license        CeCILL (http://dods.ipsl.jussieu.fr/jripsl/smon/LICENSE)
+##################################
+
+"""
+This module contains repository I/O code
+"""
+
+import sys
+
+# line below is to include Prodiguer database I/O library in the search path
+sys.path.append("/home/jripsl/snapshot/src")
+
+# import Prodiguer database I/O library
+import elixir
+import prodiguer_shared
+
+# set mode
+mode="local_repo" # local_repo, remote_repo, remote_repo__stub
+
+# set repository driver
+if mode=="remote_repo__stub":
+	import prodiguer_shared.repo.mq.hooks_stub as mq_hooks
+elif mode=="remote_repo":
+	import prodiguer_shared.repo.mq.hooks as mq_hooks
+elif mode=="local_repo":
+	import local_repo_hooks as mq_hooks
+else:
+	raise Exception("ERR001 - incorrect mode")
+
+
+
+
+
+_CONNECTION = "postgresql://postgres:Silence107!@localhost:5432/prodiguer"
+
+def init():
+	if mode=="local_repo":
+		pass
+	elif mode=="remote_repo":
+		prodiguer_shared.connect(_CONNECTION)
+	elif mode=="remote_repo__stub":
+		pass
+	else:
+		raise Exception("ERR004 - incorrect mode")
+
+def test():
+	mq_hooks.create_message("test2", 2, "bla2")
+	commit()
+
+	mq_hooks.update_simulation_status('1pctCO22', 'ERROR')
+	commit()
+
+	mq_hooks.create_message("test3", 3, "bla3")
+	rollback()
+
+def commit():
+	if mode=="local_repo":
+		pass
+	elif mode=="remote_repo":
+		elixir.session.commit()
+	elif mode=="remote_repo__stub":
+		pass
+	else:
+		raise Exception("ERR002 - incorrect mode")
+
+def rollback():
+	if mode=="local_repo":
+		pass
+	elif mode=="remote_repo":
+		elixir.session.rollback()
+	elif mode=="remote_repo__stub":
+		pass
+	else:
+		raise Exception("ERR003 - incorrect mode")
+
+def retrieve_simulation(name):
+	mq_hooks.retrieve_simulation(name)
+
+def delete_simulation(name):
+	mq_hooks.delete_simulation(name)
+
+def create_simulation(simulation):
+	mq_hooks.create_simulation(activity,
+
+def update_simulation_status(name):
+	mq_hooks.update_simulation_status(name,
+
+def retrieve_messages(name):
+	mq_hooks.retrieve_messages(name)
+
+def delete_messages(name):
+	mq_hooks.delete_messages(name)
+
+def create_message(name):
+	mq_hooks.create_message()
+
+def retrieve_last_messages(simulation):
+	mq_hooks.retrieve_last_messages(simulation)
+
+"""
+from prodiguer_shared.models import (
+	ExecutionState,
+	EXECUTION_STATE_RUNNING,
+	EXECUTION_STATE_SET,
+	Message,
+	Simulation,
+	SIMULATION_SPACE_TEST
+)
+"""
+
+# --- higher level methods --- #
+
+def get_running_simulations():
+	running_simulation=[]
+
+	for s in retrieve_simulation():
+		if s.status=="running":
+			running_simulation.append(s)
+			
+	return running_simulation
Index: trunk/Monitoring/smon/test_remote_repo.py
===================================================================
--- trunk/Monitoring/smon/test_remote_repo.py	(revision 859)
+++ trunk/Monitoring/smon/test_remote_repo.py	(revision 859)
@@ -0,0 +1,23 @@
+import sys
+sys.path.append("/home/jripsl/snapshot/src")
+
+import elixir
+
+#  Module imports.
+import prodiguer_shared.repo as repo
+import prodiguer_shared.repo.mq.hooks as mq_hooks
+
+
+# Repo connection string.
+_CONNECTION = "postgresql://postgres:Silence107!@localhost:5432/prodiguer"
+
+# Get prodiguer session handler.
+repo.connect(_CONNECTION)
+
+# Invoke hooks.
+mq_hooks.update_simulation_status('1pctCO22', 'ERROR')
+
+# Commit.
+repo.commit()
+
+
