From: cvs2svn 
Date: Sun, 25 Sep 2005 17:16:58 +0000 (+0000)
Subject: This commit was manufactured by cvs2svn to create tag 'GLITE_RELEASE_1_4_0'.
X-Git-Tag: GLITE_RELEASE_1_4_0
X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=74a36b422ea5264cae45ea4cc566f53c77d297a1;p=jra1mw.git
This commit was manufactured by cvs2svn to create tag 'GLITE_RELEASE_1_4_0'.
Sprout from master 2005-08-08 14:17:20 UTC Aleš Křenek  'clean up install: tools to sbin, examples to examples'
Cherrypick from master 2005-06-10 09:43:14 UTC Andrew McNab  'Tidy up for tag':
    org.gridsite.core/CHANGES
    org.gridsite.core/LICENSE
    org.gridsite.core/VERSION
    org.gridsite.core/doc/gacl.html
    org.gridsite.core/doc/install.html
    org.gridsite.core/doc/module.html
    org.gridsite.core/project/version.properties
    org.gridsite.core/src/Doxyfile
    org.gridsite.core/src/grst_admin_main.c
    org.gridsite.core/src/grst_gacl.c
    org.gridsite.core/src/grst_x509.c
Cherrypick from master 2004-08-17 13:41:21 UTC Elisabetta Ronchieri  'Moved out JobIdExceptions.h cjobid.h JobId.h':
    org.glite.security.proxyrenewal/project/configure.properties.xml
    org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h
Cherrypick from master 2005-02-15 09:29:04 UTC Jiří Škrábal  '- files lb_gss.* renamed to glite_gss.*':
    org.glite.security.gsoap-plugin/test/test_gss.cpp
Cherrypick from master 2005-08-11 12:04:48 UTC Aleš Křenek  'Tagged dependencies properties file [GLBUILDER]':
    org.glite.lb/project/dependencies.properties
Cherrypick from glite-security-proxyrenewal_branch_1_0_0_RC1 2005-08-10 18:42:48 UTC Joni Hahkala  'get the header from teh right place after the removal of the copy':
    org.glite.security.proxyrenewal/Makefile
    org.glite.security.proxyrenewal/build.xml
    org.glite.security.proxyrenewal/config/startup
    org.glite.security.proxyrenewal/interface/renewal.h
    org.glite.security.proxyrenewal/project/build.number
    org.glite.security.proxyrenewal/project/version.properties
    org.glite.security.proxyrenewal/src/api.c
    org.glite.security.proxyrenewal/src/commands.c
    org.glite.security.proxyrenewal/src/common.c
    org.glite.security.proxyrenewal/src/renew.c
    org.glite.security.proxyrenewal/src/renewal_locl.h
    org.glite.security.proxyrenewal/src/renewd.c
    org.glite.security.proxyrenewal/src/renewd_locl.h
    org.glite.security.proxyrenewal/src/voms.c
Cherrypick from glite-deployment-lb_branch_2_0_0 2005-09-25 17:16:57 UTC Alberto Di Meglio  'Release notes':
    org.glite.deployment.lb/CHANGELOG
    org.glite.deployment.lb/config/scripts/glite-lb-config.py
    org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
    org.glite.deployment.lb/doc/release_notes/release_notes.doc
    org.glite.deployment.lb/doc/release_notes/release_notes.html
    org.glite.deployment.lb/doc/release_notes/release_notes.pdf
    org.glite.deployment.lb/project/glite-lb.sdf.xml.template
    org.glite.deployment.lb/project/lxscript-rpm.xsl
    org.glite.deployment.lb/project/quattor-template.xsl
    org.glite.deployment.lb/project/version.properties
Cherrypick from glite-deployment-lb_branch_2_0_0 2005-09-21 10:15:48 UTC Master Builder  'Incremented build number [GLBUILDER]':
    org.glite.deployment.lb/project/build.number
Cherrypick from glite-security-gsoap-plugin_branch_1_1_0 2005-06-02 11:00:51 UTC Jiří Škrábal  '- clean connection on unsuccessfull connect':
    org.glite.security.gsoap-plugin/Makefile
    org.glite.security.gsoap-plugin/build.xml
    org.glite.security.gsoap-plugin/project/build.number
    org.glite.security.gsoap-plugin/project/configure.properties.xml
    org.glite.security.gsoap-plugin/project/version.properties
    org.glite.security.gsoap-plugin/src/glite_gsplugin.c
    org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.c
Cherrypick from glite-wms-utils-exception_branch_1_0_0 2005-07-28 13:55:08 UTC Giuseppe Avellino  'updating version':
    org.glite.wms-utils.exception/build.xml
    org.glite.wms-utils.exception/configure.ac
    org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h
    org.glite.wms-utils.exception/project/build.number
    org.glite.wms-utils.exception/project/version.properties
    org.glite.wms-utils.exception/src/Exception.cpp
Cherrypick from glite-lb-server_branch_1_2_4 2005-08-11 12:01:36 UTC Aleš Křenek  'pushed version to reflect internal testing fixes':
    org.glite.lb.server/Makefile
    org.glite.lb.server/project/configure.properties.xml
    org.glite.lb.server/project/version.properties
    org.glite.lb.server/src/request.c
Cherrypick from glite-lb-client_branch_2_0_0 2005-08-11 11:58:24 UTC Aleš Křenek  'pushed version to reflect internal testing fixes':
    org.glite.lb.client/project/version.properties
    org.glite.lb.client/src/prod_proto.c
    org.glite.lb.client/src/producer.c
Cherrypick from glite-lb-common_branch_2_0_0 2005-08-11 11:57:43 UTC Aleš Křenek  'pushed version to reflect internal testing fixes':
    org.glite.lb.common/project/version.properties
    org.glite.lb.common/src/il_msg.c
    org.glite.lb.common/test/il_msg_test.cpp
Cherrypick from glite-wms-utils-jobid_branch_1_0_0 2005-04-03 01:12:39 UTC Master Builder  'Incremented build number [GLBUILDER]':
    org.glite.wms-utils.jobid/build.xml
    org.glite.wms-utils.jobid/project/build.number
    org.glite.wms-utils.jobid/project/version.properties
Cherrypick from glite-lb-logger_branch_1_1_1 2005-08-11 12:00:24 UTC Aleš Křenek  'pushed version to reflect internal testing fixes':
    org.glite.lb.logger/project/version.properties
    org.glite.lb.logger/src/server_msg.c
Cherrypick from glite-lb_branch_1_1_0_ 2005-08-11 12:03:14 UTC Aleš Křenek  'pushed version to reflect internal testing fixes':
    org.glite.lb/project/version.properties
Delete:
    org.glite.jp.client/.cvsignore
    org.glite.jp.client/Makefile
    org.glite.jp.client/build.xml
    org.glite.jp.client/project/build.number
    org.glite.jp.client/project/build.properties
    org.glite.jp.client/project/configure.properties.xml
    org.glite.jp.client/project/properties.xml
    org.glite.jp.client/project/tar_exclude
    org.glite.jp.client/project/version.properties
    org.glite.jp.client/src/authz.c
    org.glite.jp.client/src/authz.h
    org.glite.jp.client/src/backend.h
    org.glite.jp.client/src/bones_server.c
    org.glite.jp.client/src/builtin_plugins.h
    org.glite.jp.client/src/db.h
    org.glite.jp.client/src/feed.c
    org.glite.jp.client/src/feed.h
    org.glite.jp.client/src/file_plugin.c
    org.glite.jp.client/src/ftp_backend.c
    org.glite.jp.client/src/is_client.c
    org.glite.jp.client/src/jpimporter.c
    org.glite.jp.client/src/jptype_map.h
    org.glite.jp.client/src/mysql.c
    org.glite.jp.client/src/new_ftp_backend.c
    org.glite.jp.client/src/simple_server.c
    org.glite.jp.client/src/soap_ops.c
    org.glite.jp.client/src/tags.c
    org.glite.jp.client/src/tags.h
    org.glite.jp.client/src/tags_plugin.c
    org.glite.jp.client/src/typemap.dat
    org.glite.jp.common/.cvsignore
    org.glite.jp.common/Makefile
    org.glite.jp.common/build.xml
    org.glite.jp.common/interface/context.h
    org.glite.jp.common/interface/strmd5.h
    org.glite.jp.common/interface/type_plugin.h
    org.glite.jp.common/interface/types.h
    org.glite.jp.common/project/build.number
    org.glite.jp.common/project/build.properties
    org.glite.jp.common/project/configure.properties.xml
    org.glite.jp.common/project/properties.xml
    org.glite.jp.common/project/tar_exclude
    org.glite.jp.common/project/version.properties
    org.glite.jp.common/src/attr.c
    org.glite.jp.common/src/context.c
    org.glite.jp.common/src/stdtypes.c
    org.glite.jp.common/src/strmd5.c
    org.glite.jp.index/.cvsignore
    org.glite.jp.index/Makefile
    org.glite.jp.index/build.xml
    org.glite.jp.index/project/JobProvenanceIS.wsdl
    org.glite.jp.index/project/build.number
    org.glite.jp.index/project/build.properties
    org.glite.jp.index/project/configure.properties.xml
    org.glite.jp.index/project/properties.xml
    org.glite.jp.index/project/tar_exclude
    org.glite.jp.index/project/version.properties
    org.glite.jp.index/src/simple_server.c
    org.glite.jp.index/src/soap_ops.c
    org.glite.jp.index/src/typemap.dat
    org.glite.jp.primary/.cvsignore
    org.glite.jp.primary/Makefile
    org.glite.jp.primary/build.xml
    org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql
    org.glite.jp.primary/examples/README.test
    org.glite.jp.primary/examples/jpps-test.c
    org.glite.jp.primary/interface/file_plugin.h
    org.glite.jp.primary/project/build.number
    org.glite.jp.primary/project/build.properties
    org.glite.jp.primary/project/configure.properties.xml
    org.glite.jp.primary/project/properties.xml
    org.glite.jp.primary/project/tar_exclude
    org.glite.jp.primary/project/version.properties
    org.glite.jp.primary/src/authz.c
    org.glite.jp.primary/src/authz.h
    org.glite.jp.primary/src/backend.h
    org.glite.jp.primary/src/bones_server.c
    org.glite.jp.primary/src/builtin_plugins.h
    org.glite.jp.primary/src/db.h
    org.glite.jp.primary/src/feed.c
    org.glite.jp.primary/src/feed.h
    org.glite.jp.primary/src/file_plugin.c
    org.glite.jp.primary/src/ftp_backend.c
    org.glite.jp.primary/src/is_client.c
    org.glite.jp.primary/src/is_client.h
    org.glite.jp.primary/src/jptype_map.h
    org.glite.jp.primary/src/mysql.c
    org.glite.jp.primary/src/new_ftp_backend.c
    org.glite.jp.primary/src/simple_server.c
    org.glite.jp.primary/src/soap_ops.c
    org.glite.jp.primary/src/tags.c
    org.glite.jp.primary/src/tags.h
    org.glite.jp.primary/src/tags_plugin.c
    org.glite.jp.primary/src/typemap.dat
    org.glite.jp.ws-interface/.cvsignore
    org.glite.jp.ws-interface/LICENSE
    org.glite.jp.ws-interface/Makefile
    org.glite.jp.ws-interface/build.xml
    org.glite.jp.ws-interface/interface/JobProvenanceIS.wsdl
    org.glite.jp.ws-interface/project/build.number
    org.glite.jp.ws-interface/project/build.properties
    org.glite.jp.ws-interface/project/configure.properties.xml
    org.glite.jp.ws-interface/project/glite-jp-ws-interface.spec
    org.glite.jp.ws-interface/project/properties.xml
    org.glite.jp.ws-interface/project/tar_exclude
    org.glite.jp.ws-interface/project/version.properties
    org.glite.jp.ws-interface/src/JobProvenancePS.xml
    org.glite.jp.ws-interface/src/JobProvenanceTypes.xml
    org.glite.jp.ws-interface/src/doc.xml
    org.glite.jp.ws-interface/src/puke-ug.xsl
    org.glite.jp.ws-interface/src/puke-wsdl.xsl
    org.glite.jp/.cvsignore
    org.glite.jp/build.xml
    org.glite.jp/project/build.number
    org.glite.jp/project/build.properties
    org.glite.jp/project/dependencies.properties
    org.glite.jp/project/glite.jp.csf.xml
    org.glite.jp/project/properties.xml
    org.glite.jp/project/run-workspace
    org.glite.jp/project/taskdefs.xml
    org.glite.jp/project/version.properties
    org.glite.security.proxyrenewal/src/acstack.h
    org.glite.security.proxyrenewal/src/newformat.h
    org.glite.wms-utils.exception/test/Makefile.am
    org.glite.wms-utils.exception/test/exception_cu_main.cpp
    org.glite.wms-utils.exception/test/exception_cu_suite.cpp
    org.glite.wms-utils.exception/test/exception_cu_suite.h
    org.glite.wms-utils.jobid/test/Makefile.am
    org.glite.wms-utils.jobid/test/jobid_cu_main.cpp
    org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp
    org.glite.wms-utils.jobid/test/jobid_cu_suite.h
    org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp
    org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp
    org.glite.wms-utils.jobid/test/manipulation_cu_suite.h
---
diff --git a/org.glite.deployment.lb/CHANGELOG b/org.glite.deployment.lb/CHANGELOG
index 9f1b376..32a02b4 100644
--- a/org.glite.deployment.lb/CHANGELOG
+++ b/org.glite.deployment.lb/CHANGELOG
@@ -1,3 +1,9 @@
+DATE: 13-09-2005 23:00
+[dimeglio] Use standard mysql module functions to create db
+
+DATE: 08-07-2005 15:20
+[dimeglio] Increased major version because of interface changes in the config scripts
+
 DATE: 08-07-2005 15:20
 [dimeglio] Merged from branch 1.2.2
 
diff --git a/org.glite.deployment.lb/config/scripts/glite-lb-config.py b/org.glite.deployment.lb/config/scripts/glite-lb-config.py
index f63be09..2151f54 100644
--- a/org.glite.deployment.lb/config/scripts/glite-lb-config.py
+++ b/org.glite.deployment.lb/config/scripts/glite-lb-config.py
@@ -6,7 +6,7 @@
 # For license conditions see the license file or http://eu-egee.org/license.html
 #
 ################################################################################
-# glite-lb-config v. 1.3.0
+# glite-lb-config v. 2.0.2
 #
 # Post-installation script for configuring the gLite Logging and Bookkeping Server
 # Robert Harakaly < robert.harakaly@cern.ch >
@@ -16,9 +16,13 @@
 # Version info: $Id$
 #
 # Usage: python glite-lb-config [-c|-v|-h|--help]
-#        -c          print configuration
-#        -v          print version
-#        -h,--help   print usage info
+#        -c, --checkconf         print configuration
+#        -v, --version           print version
+#        -h,--help               print usage info
+#        --configure             configure the service
+#        --start                 start the service
+#        --stop                  stop the service
+#        --status                show service status
 #
 # Return codes: 0 - Ok
 #               1 - Configuration failed
@@ -42,7 +46,7 @@ class glite_lb:
     def __init__(self):
         self.mysql = MySQL.Mysql()
         self.verbose = 0
-        self.version = "1.3.0"
+        self.version = "2.0.2"
         self.name = "glite-lb"
         self.friendly_name = "gLite Logging and Bookkeeping"
         params['module.version'] = self.version
@@ -98,6 +102,7 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
         print '    -c, --checkconf     print the service configuration'
         print '    -v, --version       print the version of the configuration script'
         print '    -h, --help          print this usage information'
+        print '    --configure         configure the service'
         print '    --start             start the service'
         print '    --stop              stop the service'
         print '    --status            check service status'
@@ -178,6 +183,10 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
             print 'The LB Server service has been stopped            ',
             glib.printOkMessage()
         
+        #-------------------------------------------------------------------
+        # MySQL
+        #-------------------------------------------------------------------
+
         self.mysql.stop()
 
         #-------------------------------------------------------------------
@@ -215,12 +224,11 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
         #--------------------------------------------------------
         
         if os.system("python %s/glite-security-utils-config.py --subservice" % glib.getScriptPath()):
-            print "\nInstalling gLite Security Utilities                   ",
+            print "\nConfiguring gLite Security Utilities                   ",
             glib.printFailedMessage()
-            return 1
-
-        print "\nInstalling gLite Security Utilities                   ",
-        glib.printOkMessage()
+        else:
+            print "\nConfiguring gLite Security Utilities                   ",
+            glib.printOkMessage()
         
         # Create the GLITE_USER if it doesn't exists
         print "\nCreating/Verifying the GLITE_USER account %s" % os.environ['GLITE_USER']
@@ -244,17 +252,28 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
         os.chmod("%s/hostkey.pem" % lb_cert_path, 0400)
         glib.printOkMessage()
 
-        # Create the MySQL database
-        print "\nCreate/Verify the %s database" % params['lb.database.name']
+        #--------------------------------------------------------
+        # Configure MySQL
+        #--------------------------------------------------------
+
+        # start MySQL
         self.mysql.stop()
         time.sleep(5)
-        self.mysql.start()
-        
+        self.mysql.start()                
+
         if not os.path.exists('/tmp/mysql.sock'):
             os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
 
+        # Set root password
+        mysql_root_password = params['mysql.root.password']
+        if mysql_root_password != "":
+            self.mysql.setpassword(mysql_root_password)
+
+        # Create the MySQL database
+        print "\nCreate/Verify the %s database" % params['lb.database.name']
+        
         # Check if database exists
-        if self.mysql.existsDB(params['lb.database.name']) != 0:
+        if self.mysql.existsDB(params['lb.database.name'],mysql_root_password) != 0:
             # Create database
             print ('\n==> Creating MySQL %s database\n' % params['lb.database.name'])
     
@@ -262,15 +281,14 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
                 os.remove('/tmp/mysql_ct')
             
             file = open('/tmp/mysql_ct', 'w')
-            text = ['CREATE DATABASE %s;\n' % params['lb.database.name'], 
-                       'GRANT ALL PRIVILEGES ON %s.* TO %s@localhost IDENTIFIED BY "";\n' \
-                       % (params['lb.database.name'],params['lb.database.username']),
-                       'USE %s;\n' % params['lb.database.name'],
-                       '\. %s/etc/glite-lb-dbsetup.sql\n' % os.environ['GLITE_LOCATION']]
+
+            self.mysql.add_user(params['lb.database.name'],params['lb.database.username'],"",mysql_root_password)
+            text = ['USE %s;\n' % params['lb.database.name'],
+                    '\. %s/etc/glite-lb-dbsetup.sql\n' % os.environ['GLITE_LOCATION']]
     
             file.writelines(text)
             file.close()
-            os.system('/usr/bin/mysql < /tmp/mysql_ct')
+            os.system('/usr/bin/mysql -p%s < /tmp/mysql_ct' % mysql_root_password)
             os.system('/bin/rm /tmp/mysql_ct')
             
             #Starting and stopping the database before the index creation
@@ -330,6 +348,13 @@ python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
 # Set all environment variables
 #-------------------------------------------------------------------------------
 
+def loadDefaults(params):
+
+    params['GLITE_LOCATION'] = "/opt/glite"
+    params['mysql.root.password'] = ""
+    params['lb.database.name'] = "lbserver20"
+    params['lb.database.username'] = "lbserver"
+
 def set_env():
 
     # gLite
@@ -385,6 +410,7 @@ if __name__ == '__main__':
     
     # Load parameters
     params = {}
+    loadDefaults(params)
     try:
         opts, args = getopt.getopt(sys.argv[1:], '', ['siteconfig='])
         for o, a in opts:
@@ -415,66 +441,109 @@ if __name__ == '__main__':
     
     # Command line opts if any
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'chv', ['checkconf', 'help', 'version','stop','start','status','siteconfig='])
+        opts, args = getopt.getopt(sys.argv[1:], 'chv', ['checkconf', 'help', 'version','configure','stop','start','status','siteconfig='])
     except getopt.GetoptError:
         service.usage(msg = "Unknown options(s)")
         sys.exit(1)
 
+    if len(opts) == 0:
+        service.usage()
+        sys.exit(0)
+    
     # Check cli options
     for o, a in opts:
+
         if o in ("-h", "--help"):
             service.usage()
             sys.exit(0)
+
         if o in ("-v", "--version"):
             service.showVersion()
             sys.exit(0)
+
         if o in ("-c", "--checkconf"):
             service.copyright()
             service.showVersion()
             glib.print_params(params)
             sys.exit(0)
-   	if o in ("stop", "--stop"): 
+
+        if o == "--configure":
+
+            # Check certificates
+            if params.has_key('glite.installer.checkcerts'):
+                if params['glite.installer.checkcerts'] == "true":
+                    if glib.check_certs(params) != 0:
+                        print "An error occurred while configuring the %s service" \
+                            % service.friendly_name
+                        sys.exit(1)
+            
+            # Print configuration parameters
+            if verbose:
+                glib.print_params(params)
+        
+            service.copyright()
+            service.showVersion()
+            service.banner()
+                
+            # Stop all services
+            glib.printInfoMessage("\n\nStopping all running LB services...")
             service.stop()
-            sys.exit(0)
-	if o in ("start", "--start"):
-            service.start()
-            sys.exit(0)
-        if o == "--status":
-            sys.exit(service.status())
+            
+            # Configure the service
+            return_result = service.configure()
+
+            if return_result == 0:
+
+                # Stop all services
+                glib.printInfoMessage("\n\nStopping all running LB services...")
+                service.stop()
                 
+                print "\n\nThe %s configuration was successfully completed\n" % service.friendly_name
+                print "You can now start the service using the --start option of this script\n\n"
+                glib.registerService()
+
+                sys.exit(0)
 
-    # Check certificates
-    if params.has_key('glite.installer.checkcerts'):
-        if params['glite.installer.checkcerts'] == "true":
-            if glib.check_certs(params) != 0:
-                print "An error occurred while configuring the %s service" \
+            elif return_result == 2:
+
+                # Stop all services
+                glib.printInfoMessage("\n\nStopping all running LB services...")
+                service.stop()
+                
+                print "\n\nThe %s configuration was completed,\n" % service.friendly_name
+                print "but warnings were issued. Please revise them and re-run the script\n"
+                print "or configure LB manually\n"
+
+                sys.exit(2)
+
+            else:
+                print "\n\nAn unrecoverable error occurred while configuring the %s" \
                     % service.friendly_name
-                sys.exit(1)
-    
-    # Print configuration parameters
-    if verbose:
-        glib.print_params(params)
 
-    service.copyright()
-    service.showVersion()
-    service.banner()
-        
-    # Configure the service
-    if service.configure() == 0:
-        print "\n%s configuration successfully completed                " % service.friendly_name,
-        glib.printOkMessage()
-        glib.registerService()
-    else:
-        print "\nAn error occurred while configuring the %s            " % service.friendly_name,
-        glib.printFailedMessage()
-        sys.exit(1)
+                sys.exit(1)
+            
+        if o in ("start", "--start"):
+            # Start the service
+            if service.start() == 0:
+                print "\n\nThe %s was successfully started           " % service.friendly_name,
+                glib.printOkMessage()
+                sys.exit(0)
+            else:
+                print "\n\nAn error occurred while starting the %s            " % service.friendly_name,
+                glib.printFailedMessage()
+                sys.exit(1)
+            
+        if o in ("stop", "--stop"): 
+            # Stop the service
+            if service.stop() == 0:
+                print "\n\nThe %s was successfully stopped           " % service.friendly_name,
+                glib.printOkMessage()
+                sys.exit(0)
+            else:
+                print "\n\nAn unrecoverable error occurred while stopping the %s " % service.friendly_name,
+                glib.printFailedMessage()
+                sys.exit(1)
         
-    # Start the service
-    if service.start() == 0:
-        print "\nThe %s was successfully started           " % service.friendly_name,
-        glib.printOkMessage()
-    else:
-        print "\nAn error occurred while starting the %s            " % service.friendly_name,
-        glib.printFailedMessage()
-        sys.exit(1)
-
+        if o == "--status":
+            sys.exit(service.status())
+                
diff --git a/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml b/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
index ed39d97..72ada69 100644
--- a/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
+++ b/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
@@ -17,6 +17,10 @@
 			parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
 			value="changeme"/>
              	
+	    
 			
@@ -45,15 +47,6 @@
 
 		 
 			
-		
-
-
gLite Logging & Bookkeeping Server 
-
-
1.  Release Description 
-
-
This release contains the gLite Logging & Bookkeeping
-Server module v. 1.2.3. The following sections provide additional information about
-the release content, the module dependencies, the know bugs and issues and a
-list of bugs closed since the previous release. For information about
-installing and using the gLite Logging & Bookkeeping Server, please refer
-to the gLite Installation and User Guides. 
-
-
2.  Changes in this Release 
-
-
This release introduces the following changes:
-
-
 
-
-
- All R-GMA service publishing
-     instances in the configuration template now have default values 
- Bug fixes (see below for the complete lists) 
- 
-
-
3. Release contents 
-
-
The gLite Logging & Bookkeeping Server v. 1.2.3 is
-composed of the following gLite components:
-
-
 
-
-
-
-
  
-
-
4. Dependencies 
-
-
The gLite Logging & Bookkeeping Server v. 1.2.2 module
-has the following dependencies:
-
-
 
-
-
-
-
 
-
-
5. Known bugs and issues 
-
-
This release has the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at https://savannah.cern.ch/bugs/?group=jra1mdw 
-.
-
-
 
+	margin-left:54.0pt;
+	text-align:justify;
+	text-indent:-18.0pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListNumber4, li.MsoListNumber4, div.MsoListNumber4
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:72.0pt;
+	text-align:justify;
+	text-indent:-18.0pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListNumber5, li.MsoListNumber5, div.MsoListNumber5
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:90.0pt;
+	text-align:justify;
+	text-indent:-18.0pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoTitle, li.MsoTitle, div.MsoTitle
+	{margin-top:12.0pt;
+	margin-right:0mm;
+	margin-bottom:3.0pt;
+	margin-left:0mm;
+	text-align:center;
+	font-size:16.0pt;
+	font-family:Arial;
+	font-weight:bold;}
+p.MsoClosing, li.MsoClosing, div.MsoClosing
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:216.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoSignature, li.MsoSignature, div.MsoSignature
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:216.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+	{margin-top:3.0pt;
+	margin-right:0mm;
+	margin-bottom:3.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyTextIndent, li.MsoBodyTextIndent, div.MsoBodyTextIndent
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:18.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListContinue, li.MsoListContinue, div.MsoListContinue
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:18.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListContinue2, li.MsoListContinue2, div.MsoListContinue2
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:36.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListContinue3, li.MsoListContinue3, div.MsoListContinue3
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:54.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListContinue4, li.MsoListContinue4, div.MsoListContinue4
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:72.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoListContinue5, li.MsoListContinue5, div.MsoListContinue5
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:90.0pt;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoMessageHeader, li.MsoMessageHeader, div.MsoMessageHeader
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:54.0pt;
+	text-align:justify;
+	text-indent:-54.0pt;
+	background:#CCCCCC;
+	border:none;
+	padding:0mm;
+	font-size:12.0pt;
+	font-family:Arial;}
+p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:3.0pt;
+	margin-left:0mm;
+	text-align:center;
+	font-size:12.0pt;
+	font-family:Arial;}
+p.MsoSalutation, li.MsoSalutation, div.MsoSalutation
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoDate, li.MsoDate, div.MsoDate
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyTextFirstIndent, li.MsoBodyTextFirstIndent, div.MsoBodyTextFirstIndent
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	text-indent:10.5pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyTextFirstIndent2, li.MsoBodyTextFirstIndent2, div.MsoBodyTextFirstIndent2
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:18.0pt;
+	text-align:justify;
+	text-indent:10.5pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoNoteHeading, li.MsoNoteHeading, div.MsoNoteHeading
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	line-height:200%;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyText3, li.MsoBodyText3, div.MsoBodyText3
+	{margin-top:2.5pt;
+	margin-right:0mm;
+	margin-bottom:2.5pt;
+	margin-left:0mm;
+	text-align:justify;
+	page-break-after:avoid;
+	font-size:10.0pt;
+	font-family:Arial;}
+p.MsoBodyTextIndent2, li.MsoBodyTextIndent2, div.MsoBodyTextIndent2
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:18.0pt;
+	text-align:justify;
+	line-height:200%;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.MsoBodyTextIndent3, li.MsoBodyTextIndent3, div.MsoBodyTextIndent3
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:18.0pt;
+	text-align:justify;
+	font-size:8.0pt;
+	font-family:"Times New Roman";}
+p.MsoBlockText, li.MsoBlockText, div.MsoBlockText
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	text-indent:17.0pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+a:link, span.MsoHyperlink
+	{color:blue;
+	text-decoration:underline;}
+a:visited, span.MsoHyperlinkFollowed
+	{color:purple;
+	text-decoration:underline;}
+p.MsoDocumentMap, li.MsoDocumentMap, div.MsoDocumentMap
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	background:navy;
+	font-size:11.0pt;
+	font-family:Tahoma;}
+p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:10.0pt;
+	font-family:"Courier New";}
+p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p
+	{margin-top:5.0pt;
+	margin-right:0mm;
+	margin-bottom:5.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:12.0pt;
+	font-family:"Times New Roman";}
+address
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:"Times New Roman";
+	font-style:italic;}
+pre
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:10.0pt;
+	font-family:"Courier New";}
+tt
+	{font-family:"Courier New";}
+p.MsoCommentSubject, li.MsoCommentSubject, div.MsoCommentSubject
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:10.0pt;
+	font-family:"Times New Roman";
+	font-weight:bold;}
+p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:8.0pt;
+	font-family:Tahoma;}
+p.3eretraitnormal, li.3eretraitnormal, div.3eretraitnormal
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:3.0pt;
+	margin-left:102.9pt;
+	text-align:justify;
+	text-indent:-17.85pt;
+	font-size:12.0pt;
+	font-family:"Times New Roman";}
+p.2eretraitjustifi, li.2eretraitjustifi, div.2eretraitjustifi
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:3.0pt;
+	margin-left:40.0mm;
+	text-align:justify;
+	text-indent:-7.1pt;
+	line-height:12.0pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.2eretraitnormal, li.2eretraitnormal, div.2eretraitnormal
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:3.0pt;
+	margin-left:18.0pt;
+	text-align:justify;
+	text-indent:-18.0pt;
+	font-size:12.0pt;
+	font-family:"Times New Roman";}
+p.1erretraitnormal, li.1erretraitnormal, div.1erretraitnormal
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:12.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:12.0pt;
+	font-family:"Times New Roman";}
+p.titrebloc, li.titrebloc, div.titrebloc
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:Arial;
+	font-weight:bold;}
+p.TitreTable, li.TitreTable, div.TitreTable
+	{margin-top:6.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:center;
+	font-size:12.0pt;
+	font-family:Arial;
+	font-weight:bold;}
+p.form, li.form, div.form
+	{margin-top:6.0pt;
+	margin-right:7.05pt;
+	margin-bottom:0mm;
+	margin-left:0mm;
+	margin-bottom:.0001pt;
+	text-align:justify;
+	background:black;
+	border:none;
+	padding:0mm;
+	font-size:14.0pt;
+	font-family:"Univers \(W1\)";
+	color:white;
+	text-transform:uppercase;
+	font-weight:bold;}
+p.HB, li.HB, div.HB
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:12.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	page-break-after:avoid;
+	font-size:12.0pt;
+	font-family:"Times New Roman";
+	color:black;
+	font-weight:bold;}
+p.reference, li.reference, div.reference
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	page-break-after:avoid;
+	font-size:9.0pt;
+	font-family:Arial;}
+p.1erretraitjustifi, li.1erretraitjustifi, div.1erretraitjustifi
+	{margin-top:6.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:14.2pt;
+	text-align:justify;
+	text-indent:-14.2pt;
+	font-size:11.0pt;
+	font-family:"Times New Roman";}
+p.ZonetatEnTte, li.ZonetatEnTte, div.ZonetatEnTte
+	{margin-top:2.0pt;
+	margin-right:2.85pt;
+	margin-bottom:2.0pt;
+	margin-left:2.85pt;
+	text-align:center;
+	page-break-after:avoid;
+	font-size:36.0pt;
+	font-family:Arial;
+	text-transform:uppercase;
+	font-weight:bold;}
+p.DocTitle, li.DocTitle, div.DocTitle
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:center;
+	font-size:22.0pt;
+	font-family:Arial;
+	font-variant:small-caps;
+	color:gray;
+	letter-spacing:4.0pt;
+	font-weight:bold;}
+p.DocDate, li.DocDate, div.DocDate
+	{margin-top:6.0pt;
+	margin-right:0mm;
+	margin-bottom:6.0pt;
+	margin-left:0mm;
+	text-align:justify;
+	font-size:11.0pt;
+	font-family:Arial;
+	layout-grid-mode:line;
+	font-weight:bold;}
+p.DocSubTitle, li.DocSubTitle, div.DocSubTitle
+	{margin-top:2.0pt;
+	margin-right:0mm;
+	margin-bottom:2.0pt;
+	margin-left:0mm;
+	text-align:center;
+	line-height:12.0pt;
+	font-size:12.0pt;
+	font-family:Arial;
+	font-variant:small-caps;
+	color:gray;
+	letter-spacing:4.0pt;
+	font-weight:bold;}
+ /* Page Definitions */
+ @page Section1
+	{size:595.3pt 841.9pt;
+	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
+div.Section1
+	{page:Section1;}
+ /* List Definitions */
+ ol
+	{margin-bottom:0mm;}
+ul
+	{margin-bottom:0mm;}
+-->
+
 
-
- If the mysql root password is set
-     and it is not specified in the mysql.conf file, the configuration script
-     fails. This bug will be fixed in the next release 
- No removal procedure is provided
-     with this release apart from the removal of the RPMS. Any account, group
-     or other resource created during the module configuration must be manually
-     cleaned. 
- 
+
 
-
 
+
 
-
Known open bugs:
+
 
-
 
+
gLite Logging & Bookkeeping Server 
 
-
- 
-  
-  Bug number 
-   
-  
-  Description 
-   
-  
-    
-   
-  
- 
-  
-   #7053 
-   
-  
-  LB configuration fails if the
-  mysql root pwd is set 
-   
-  
-    
-   
-  
- 
-  
-   #7237 
-   
-  
-  Intermittent errors with job
-  submission 
-   
-  
-    
-   
-  
- 
-  
-   #7300 
-   
-  
-  update of the lb instructions
-  at the end of the installer script  
-   
-  
-    
-   
-  
- 
-  
-   #7305 
-   
-  
-  lb.database.username paramenter
-  in config file 
-   
-  
-    
-   
-  
- 
-  
-   #7307 
-   
-  
-  lb config script does _not_
-  fail if mysql root password is set 
-   
-  
-    
-   
-  
+1.  Release Description This release contains the gLite Logging & Bookkeeping
+Server module v. 2.0.2. The following sections provide additional information about
+the release content, the module dependencies, the know bugs and issues and a
+list of bugs closed since the previous release. For information about
+installing and using the gLite Logging & Bookkeeping Server, please refer
+to the gLite Installation and User Guides. 
+
+2.  Changes in this release 2.1.  Changes in functionality The mysql database can now be protected
+with a root password. The mysql root password can be set in the configuration
+file. 
+
+2.2. Changes in Configuration 
+
+The following new parameters have been
+added to the glite-security-utils.cfg.xml file: 
+
+  
+
+
 
- 
+  
 
-Bugs fixed in this or previous releases, but not yet officially
-tested:
+The following parameters have been changed
+in the glite-security-utils.cfg.xml file: 
 
- 
+  
 
 
+
+  
+
+The following new parameters have been
+removed from the glite-security-utils.cfg.xml file: 
+
+  
+
+
 
-  
+  
 
-6. Bugs closed since last release 
+3. Release contents 
 
-This release fixes the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at https://savannah.cern.ch/bugs/?group=jra1mdw 
- 
+
 
- 
+The gLite Logging and Bookkeeping module requires the
+following sub-modules:
 
-
+ 
+
+-         
+ gLite Security Utilities
+
+-         
+ gLite R-GMA Servicetool
+
+ 
+
+The sub-modules are automatically installed with the LB
+module. For more information about these sub-modules please refer to the
+specific release notes and installation instructions.
+
+3.2. Glite RPMS 
+
+The gLite Logging & Bookkeeping Server v. 2.0.2 is
+composed of the following gLite components:
+
+ 
+
+
-
- 
-
-7. Previous Releases 
-
-7.1. Release 1.2.2 
-
-7.1.1.  Release Description This release contains the gLite Logging & Bookkeeping
-Server module v. 1.2.2. The following sections provide additional information
-about the release content, the module dependencies, the know bugs and issues
-and a list of bugs closed since the previous release. For information about
-installing and using the gLite Logging & Bookkeeping Server, please refer
-to the gLite Installation and User Guides. 
-
-7.1.2.  Changes in this Release This release introduces the following changes:
-
- 
-
-
- Implemented status method 
- Added definition of PERL5LIB env var 
- Stopping and starting the database before the index
-     creation (just after the database is created and the user granted) to fix
-     access denied error 
- Moved creation of indices inside database creation (if
-     database exists indices must not be recreated) 
- GLITE_USER parameter is not exposed anymore in the
-     configuration file; instead the module uses the same user parameters as
-     WMS to allow installation on same node 
- LB admin tools are now installed in sbin, not in bin 
- Bug fixes (see below for the complete lists) 
- 
-
-7.1.3. Release contents 
-
-The gLite Logging & Bookkeeping Server v. 1.2.2 is
-composed of the following gLite components:
-
- 
-
-
 
-  
+ 
 
-7.1.4. Dependencies 
+4. Dependencies 
 
-The gLite Logging & Bookkeeping Server v. 1.2.2 module
+
The gLite Logging & Bookkeeping Server v. 2.0.2 module
 has the following dependencies:
 
  
@@ -1913,45 +1653,6 @@ has the following dependencies:
  
   
-  gLite Security Utilities 
-   
-  
-  1.0.0 
-   
-  
-  http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-security-utils_installer.sh 
-   
-  
- 
-  
-  gLite  R-GMA  Service Publisher 
-   
-  
-  4.1.5 
-   
-  
-  http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-rgma-servicetool_installer.sh 
-   
-  
- 
-  
   GPT 
    
@@ -1963,10 +1664,14 @@ has the following dependencies:
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gpt-VDT1.2.2rh9 -1.i386.rpm 
+  lang=EN-GB>VDT1.2.2rh9-1.i386.rpmH  
   
  
@@ -1983,10 +1688,14 @@ has the following dependencies:
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/vdt_globus_essentials-VDT1.2.2rh9 -1.i386.rpm 
+  lang=EN-GB>VDT1.2.2rh9-1.i386.rpmH  
   
  
@@ -1998,15 +1707,19 @@ has the following dependencies:
   
-  4.0.20 
+  4.1.11 
    
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-server-4.0.20 -0.i386.rpm 
+  lang=EN-GB>4.0.20-0.i386.rpmH  
   
  
@@ -2018,15 +1731,19 @@ has the following dependencies:
   
-  4.0.20 
+  4.1.11 
    
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-client-4.0.20 -0.i386.rpm 
+  lang=EN-GB>4.0.20-0.i386.rpmH  
   
  
@@ -2043,10 +1760,14 @@ has the following dependencies:
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/ares-1.1.1 -EGEE.i386.rpm 
+  lang=EN-GB>1.1.1-EGEE.i386.rpmH  
   
  
@@ -2063,10 +1784,14 @@ has the following dependencies:
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/myproxy-1.14 -EGEE.i386.rpm 
+  lang=EN-GB>1.14-EGEE.i386.rpmH  
   
  
@@ -2083,10 +1808,14 @@ has the following dependencies:
   
-  H http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/per-Expect.pm-1.01 -9.i386.rpm 
+  lang=EN-GB>1.01-9.i386.rpmH  
   
  
@@ -2111,13 +1840,14 @@ has the following dependencies:
 
  
 
-7.1.5. Known bugs and issues 
+5. Known bugs and issues 
 
-This release has the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at https://savannah.cern.ch/bugs/?group=jra1mdw 
-.
+This
+release has the following bugs and issues. Bug numbers refer to the gLite Bug
+Tracking system database hosted on the CERN Savannah system at H https://savannah.cern.ch/bugs/?group=jra1mdw H  .
 
  
 
@@ -2137,409 +1867,369 @@ href="https://savannah.cern.ch/bugs/?group=jra1mdw">https://savannah.cern.ch/bug
 
 
  
 
-Bugs fixed in this or previous releases, but not yet
-officially tested:
+Bugs fixed in this or previous releases, but not yet officially
+tested:
 
  
 
 
@@ -2548,183 +2238,162 @@ officially tested:
 text-align:left;text-autospace:none'>  
 
-7.1.6. Bugs closed since last release 
+6. Bugs closed since last release 
 
-This release fixes the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at https://savannah.cern.ch/bugs/?group=jra1mdw 
- 
+This
+release fixes the following bugs and issues. Bug numbers refer to the gLite Bug
+Tracking system database hosted on the CERN Savannah system at H https://savannah.cern.ch/bugs/?group=jra1mdw H   
 
  
 
 
 
  
 
- 
-
 
 
 
diff --git a/org.glite.deployment.lb/doc/release_notes/release_notes.pdf b/org.glite.deployment.lb/doc/release_notes/release_notes.pdf
index cfd9fe5..422c02c 100644
Binary files a/org.glite.deployment.lb/doc/release_notes/release_notes.pdf and b/org.glite.deployment.lb/doc/release_notes/release_notes.pdf differ
diff --git a/org.glite.deployment.lb/project/build.number b/org.glite.deployment.lb/project/build.number
index 58569c4..f374002 100644
--- a/org.glite.deployment.lb/project/build.number
+++ b/org.glite.deployment.lb/project/build.number
@@ -1,2 +1,2 @@
-#Wed Apr 13 09:36:57 CEST 2005
-module.build=232
+#Wed Sep 21 12:15:44 CEST 2005
+module.build=304
diff --git a/org.glite.deployment.lb/project/glite-lb.sdf.xml.template b/org.glite.deployment.lb/project/glite-lb.sdf.xml.template
index 93bb43a..b5184c8 100644
--- a/org.glite.deployment.lb/project/glite-lb.sdf.xml.template
+++ b/org.glite.deployment.lb/project/glite-lb.sdf.xml.template
@@ -68,17 +68,19 @@
 					age="@org.glite.wms-utils.exception.info.age@"
 					build="@org.glite.wms-utils.exception.info.build@"
 					arch="i386"/>
-	
-				
 	
+
 template pro_software_glite_lb;
 
 #
@@ -22,6 +23,12 @@ template pro_software_glite_lb;
 # glite-lb Quattor template v. 
 			 
 
+			
+include pro_software_ 			
+			
+
 		
 	 
 
diff --git a/org.glite.deployment.lb/project/version.properties b/org.glite.deployment.lb/project/version.properties
index 66a3e69..9a0479a 100644
--- a/org.glite.deployment.lb/project/version.properties
+++ b/org.glite.deployment.lb/project/version.properties
@@ -1,4 +1,4 @@
 
-module.version = 1.3.0
+module.version = 2.0.2
 module.age = 1
 				
\ No newline at end of file
diff --git a/org.glite.jp.client/.cvsignore b/org.glite.jp.client/.cvsignore
deleted file mode 100644
index 3a4edf6..0000000
--- a/org.glite.jp.client/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-.project
diff --git a/org.glite.jp.client/Makefile b/org.glite.jp.client/Makefile
deleted file mode 100644
index 345a7c1..0000000
--- a/org.glite.jp.client/Makefile
+++ /dev/null
@@ -1,135 +0,0 @@
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-jpprefix=jp
-package=glite-jp-client
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/project:${stagedir}/interface
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
-	-lglobus_common_${nothrflavour} \
-	-lglobus_gssapi_gsi_${nothrflavour}
-
-GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
-
-DEBUG:=-g -O0 -DDEBUG
-
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${stagedir}/include ${GLOBUS_CFLAGS}
-LDFLAGS:=-L${stagedir}/lib
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS} 
-LTCOMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
-INSTALL:=libtool --mode=install install
-
-daemon:=glite-jp-importer
-
-wsprefix:=jpps_
-
-SRCS:= jpimporter.c \
-	${wsprefix}ClientLib.c ${wsprefix}C.c
-#	env_C.c
-
-EXA_SRCS:=
-
-OBJS:=${SRCS:.c=.o}
-EXA_OBJS:=${EXA_SRCS:.c=.o}
-
-COMMONLIB:=-lglite_jp_common
-GSOAPLIB:=-lglite_security_gsoap_plugin_${nothrflavour} -lglite_security_gss_${nothrflavour} \
-	-L${gsoap_prefix}/lib -lgsoap${GSOAP_DEBUG} -L${ares_prefix}/lib -lares
-LBMAILDIRLIB:=-lglite_lb_maildir
-
-default all: compile
-
-compile: ${daemon} 
-
-${daemon}: ${OBJS}
-	${LINK} -o $@ ${OBJS} ${LBMAILDIRLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS}
-
-
-JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat
-	cp  ${stagedir}/interface/JobProvenanceTypes.wsdl .
-	${gsoap_prefix}/bin/wsdl2h  -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
-	rm -f JobProvenanceTypes.wsdl
-
-${wsprefix}Client.c ${wsprefix}ClientLib.c  \
-${wsprefix}C.c ${wsprefix}H.h: JobProvenancePS.xh
-	${gsoap_prefix}/bin/soapcpp2 -n -w -c -p ${wsprefix} JobProvenancePS.xh
-
-env_C.c env_Server.c:
-	touch env.xh
-	cp  ${jpproject}/JobProvenanceTypes.wsdl .
-	${gsoap_prefix}/bin/wsdl2h  -t ${top_srcdir}/src/typemap.dat -c -o env.xh JobProvenanceTypes.wsdl
-	rm -f JobProvenanceTypes.wsdl
-	${gsoap_prefix}/bin/soapcpp2 -w -c -p env_ env.xh
-
-${OBJS}: ${wsprefix}H.h soap_version.h
-
-soap_version.h:
-	${gsoap_prefix}/bin/soapcpp2 /dev/null
-	perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
-	-rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp
-
-
-
-
-check: 
-	-echo nothing yet
-
-doc:
-
-stage: compile
-	${MAKE} PREFIX=${stagedir} DOSTAGE=yes install
-
-dist: distsrc distbin
-
-distsrc:
-	mkdir -p ${top_srcdir}/${package}-${version}
-	cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
-	cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
-	rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
-	$(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
-	save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
-	rm -rf tmpbuilddir
-        
-install:
-	-mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/examples ${PREFIX}/etc/init.d
-	${INSTALL} -m 755 ${daemon} ${PREFIX}/bin
-
-clean:
-
-# we have no real config.h but have to force gSoap not to use
-# linux ftime with broken (aka obsolete) DST information
-stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c
-	test -f config.h || touch config.h
-	@echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless'
-	${CC} -o $@ -c -DWITH_NONAMESPACES -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c
-
-
-%.lo: %.c
-	${LTCOMPILE} -o $@ -c $<
-
-%.o: %.c
-	${LTCOMPILE} -o $@ -c $<
diff --git a/org.glite.jp.client/build.xml b/org.glite.jp.client/build.xml
deleted file mode 100755
index 8a40155..0000000
--- a/org.glite.jp.client/build.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-	
-	
-	
-	
-
-	
-	
-
-		 
-		
-	
-	 
-	
-	
-	 
-	
- 		
diff --git a/org.glite.jp.client/project/build.number b/org.glite.jp.client/project/build.number
deleted file mode 100644
index d794048..0000000
--- a/org.glite.jp.client/project/build.number
+++ /dev/null
@@ -1 +0,0 @@
-module.build=0
diff --git a/org.glite.jp.client/project/build.properties b/org.glite.jp.client/project/build.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/org.glite.jp.client/project/configure.properties.xml b/org.glite.jp.client/project/configure.properties.xml
deleted file mode 100644
index 3744be5..0000000
--- a/org.glite.jp.client/project/configure.properties.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-	
-        
-	                                                                        
-		
-			
-				 
-			
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-ares_prefix=${with.ares.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
-			 
-	     
-	 
diff --git a/org.glite.jp.client/project/properties.xml b/org.glite.jp.client/project/properties.xml
deleted file mode 100755
index e2a32d0..0000000
--- a/org.glite.jp.client/project/properties.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-	
-	 
diff --git a/org.glite.jp.client/project/tar_exclude b/org.glite.jp.client/project/tar_exclude
deleted file mode 100644
index e1fcd1a..0000000
--- a/org.glite.jp.client/project/tar_exclude
+++ /dev/null
@@ -1,10 +0,0 @@
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
diff --git a/org.glite.jp.client/project/version.properties b/org.glite.jp.client/project/version.properties
deleted file mode 100644
index cd1e9e7..0000000
--- a/org.glite.jp.client/project/version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-module.version=1.0.0
-module.age=1
diff --git a/org.glite.jp.client/src/authz.c b/org.glite.jp.client/src/authz.c
deleted file mode 100644
index 3e6d6e4..0000000
--- a/org.glite.jp.client/src/authz.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpps_H.h"
-
-int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner)
-{
-	glite_jp_error_t	err;
-	char	buf[200];
-	int	i;
-
-	memset(&err,0,sizeof err);
-	glite_jp_clear_error(ctx);
-	err.source = __FUNCTION__;
-	err.code = EPERM;
-	
-	switch (op) {
-		case SOAP_TYPE___jpsrv__RegisterJob:
-		case SOAP_TYPE___jpsrv__StartUpload:
-		case SOAP_TYPE___jpsrv__CommitUpload:
-			for (i=0; ctx->trusted_peers && ctx->trusted_peers[i]; i++) 
-				if (!strcmp(ctx->trusted_peers[i],ctx->peer)) return 0;
-			err.desc = "you are not a trusted peer";
-			return glite_jp_stack_error(ctx,&err);
-
-		case SOAP_TYPE___jpsrv__GetJob:
-			assert(owner);
-			return strcmp(owner,ctx->peer) ? glite_jp_stack_error(ctx,&err) : 0;
-			break;
-
-		default:
-			snprintf(buf,sizeof buf,"%d: unknown operation",op);
-			err.desc = buf;
-			err.code = EINVAL;
-			return glite_jp_stack_error(ctx,&err);
-	}
-}
-
-int glite_jpps_readauth(glite_jp_context_t ctx,const char *file)
-{
-	FILE	*f = fopen(file,"r");
-	glite_jp_error_t	err;
-	int	cnt = 0;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	if (!f) {
-		err.code = errno;
-		err.desc = file;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	ctx->trusted_peers = NULL;
-	while (!feof(f)) {
-		char	buf[BUFSIZ];
-
-		if (fscanf(f,"%[^\n]\n",buf) != 1) {
-			err.code = EINVAL;
-			err.desc = file;
-			fclose(f);
-			return glite_jp_stack_error(ctx,&err);
-		}
-
-		ctx->trusted_peers = realloc(ctx->trusted_peers, (cnt+1) * sizeof *ctx->trusted_peers);
-		ctx->trusted_peers[cnt++] = strdup(buf);
-		ctx->trusted_peers[cnt] = NULL;
-	}
-	fclose(f);
-	return 0;
-}
diff --git a/org.glite.jp.client/src/authz.h b/org.glite.jp.client/src/authz.h
deleted file mode 100644
index 9451aef..0000000
--- a/org.glite.jp.client/src/authz.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Check authorisation of JPPS operation on job.
- *
- * \param[in] ctx	JP context including peer name & other credentials (VOMS etc.)
- * \param[in] op	operation, one of SOAP_TYPE___jpsrv__*
- * \param[in] job	jobid of the job to decide upon
- * \param[in] owner	current known owner of the job (may be NULL), shortcut to avoid
- *			unnecessary database query.
- *
- * \retval 0		OK, operation permitted
- * \retval EPERM	denied
- * \retval other	error
- */
-
-int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner);
-
-int glite_jpps_readauth(glite_jp_context_t ctx,const char *file);
-
diff --git a/org.glite.jp.client/src/backend.h b/org.glite.jp.client/src/backend.h
deleted file mode 100644
index cf901fb..0000000
--- a/org.glite.jp.client/src/backend.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef __GLITE_JP_BACKEND
-#define __GLITE_JP_BACKEND
-
-#include 
-#include 
-
-int glite_jppsbe_init(
-	glite_jp_context_t ctx,
-	int argc,
-	char *argv[]
-);
-
-int glite_jppsbe_init_slave(
-	glite_jp_context_t ctx
-);
-
-int glite_jppsbe_register_job(	
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *owner
-);
-
-int glite_jppsbe_start_upload(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,	/* must be filesystem-friendly */
-	const char *name,	/* optional name within the class */
-	const char *content_type,
-	char **destination_out,
-	time_t *commit_before_inout
-);
-
-int glite_jppsbe_commit_upload(
-	glite_jp_context_t ctx,
-	const char *destination
-);
-
-int glite_jppsbe_get_names(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	char	***names_out
-);
-
-int glite_jppsbe_destination_info(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char **job_out,
-	char **class_out,
-	char **name_out
-);
-
-int glite_jppsbe_get_job_url(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* optional within class */
-	char **url_out
-);
-
-int glite_jppsbe_open_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* optional within class */
-	int mode,
-	void **handle_out
-);
-
-int glite_jppsbe_close_file(
-	glite_jp_context_t ctx,
-	void *handle
-);
-
-int glite_jppsbe_pread(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset,
-	ssize_t *nbytes_ret
-);
-
-int glite_jppsbe_pwrite(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset
-);
-
-int glite_jppsbe_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes
-);
-
-int glite_jppsbe_get_job_metadata(
-	glite_jp_context_t ctx,
-	const char *job,
-	glite_jp_attrval_t attrs_inout[]
-);
-
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-);
-
-#endif
diff --git a/org.glite.jp.client/src/bones_server.c b/org.glite.jp.client/src/bones_server.c
deleted file mode 100644
index 8a47169..0000000
--- a/org.glite.jp.client/src/bones_server.c
+++ /dev/null
@@ -1,327 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "glite/lb/srvbones.h"
-#include "glite/security/glite_gss.h"
-
-#include 
-#include "glite/security/glite_gsplugin.h"
-
-#include "backend.h"
-#include "file_plugin.h"
-
-#include "soap_version.h"
-#include "jpps_H.h"
-
-#define CONN_QUEUE	20
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-
-static int newconn(int,struct timeval *,void *);
-static int request(int,struct timeval *,void *);
-static int reject(int);
-static int disconn(int,struct timeval *,void *);
-static int data_init(void **data);
-
-static struct glite_srvbones_service stab = {
-	"JP Primary Storage", -1, newconn, request, reject, disconn
-};
-
-static time_t cert_mtime;
-static char *server_cert, *server_key, *cadir;
-static gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL;
-static char *mysubj;
-
-static char *port = "8901";
-static int debug = 1;
-
-static glite_jp_context_t	ctx;
-
-static int call_opts(glite_jp_context_t,char *,char *,int (*)(glite_jp_context_t,int,char **));
-
-char *glite_jp_default_namespace;
-
-int main(int argc, char *argv[])
-{
-	int	one = 1,opt,i;
-	edg_wll_GssStatus	gss_code;
-	struct sockaddr_in	a;
-	char	*b_argv[20] = { "backend" },*p_argv[20] = { "plugins" },*com;
-	int	b_argc,p_argc;
-
-	glite_jp_init_context(&ctx);
-
-	b_argc = p_argc = 1;
-
-	while ((opt = getopt(argc,argv,"B:P:a:")) != EOF) switch (opt) {
-		case 'B':
-			assert(b_argc < 20);
-			if (com = strchr(optarg,',')) *com = 0;
-			
-			/* XXX: memleak -- who cares for once */
-			asprintf(&b_argv[b_argc++],"-%s",optarg);
-			if (com) b_argv[b_argc++] = com+1;
-
-			break;
-		case 'P':
-			assert(p_argc < 20);
-			p_argv[p_argc++] = optarg;
-
-			break;
-		case 'a':
-			if (glite_jpps_readauth(ctx,optarg)) {
-				fprintf(stderr,"%s: %s\n",argv[0],glite_jp_error_chain(ctx));
-				exit (1);
-			}
-			break;
-		case '?': fprintf(stderr,"usage: %s: -Bb,val ... -Pplugin.so ...\n"
-					  "b is backend option\n",argv[0]);
-			  exit (1);
-	}
-
-	if (b_argc == 1) {
-		fputs("-B required\n",stderr);
-		exit (1);
-	}
-	
-	optind = 0; /* XXX: getopt used internally */
-	if (glite_jppsbe_init(ctx,b_argc,b_argv)) {
-		fputs(glite_jp_error_chain(ctx), stderr);
-		exit(1);
-	}
-
-	optind = 0; /* XXX: getopt used internally */
-	if (b_argc > 1 && glite_jpps_fplug_load(ctx,p_argc,p_argv)) {
-		fputs(glite_jp_error_chain(ctx), stderr);
-		exit(1);
-	}
-
-	srand48(time(NULL)); /* feed id generation */
-
-#if GSOAP_VERSION <= 20602
-	for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"ns1"); i++);
-#else
-	for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"jpsrv"); i++);
-#endif
-	assert(jpps__namespaces[i].id);
-	glite_jp_default_namespace = jpps__namespaces[i].ns;
-
-	stab.conn = socket(PF_INET, SOCK_STREAM, 0);
-	if (stab.conn < 0) {
-		perror("socket");
-		return 1;
-	}
-
-	setsockopt(stab.conn,SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
-
-	a.sin_family = AF_INET;
-	a.sin_addr.s_addr = INADDR_ANY;
-	a.sin_port = htons(atoi(port));
-	if (bind(stab.conn,(struct sockaddr *) &a, sizeof(a)) ) {
-		char	buf[200];
-
-		snprintf(buf,sizeof(buf),"bind(%d)",atoi(port));
-		perror(buf);
-		return 1;
-	}
-
-	if (listen(stab.conn,CONN_QUEUE)) {
-		perror("listen()");
-		return 1;
-	}
-
-	if (!server_cert || !server_key)
-		fprintf(stderr, "%s: WARNING: key or certificate file not specified, "
-				"can't watch them for changes\n",
-				argv[0]);
-
-	if ( cadir ) setenv("X509_CERT_DIR", cadir, 1);
-	edg_wll_gss_watch_creds(server_cert, &cert_mtime);
-
-	if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &mysubj, &gss_code)) 
-		fprintf(stderr,"Server idenity: %s\n",mysubj);
-	else fputs("WARNING: Running unauthenticated\n",stderr);
-
-	/* XXX: daemonise */
-
-	glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,1);
-	glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug);
-
-	return 0;
-}
-
-static int data_init(void **data)
-{
-	*data = (void *) soap_new();
-
-	printf("[%d] slave started\n",getpid());
-	glite_jppsbe_init_slave(ctx);	/* XXX: global but slave's */
-
-	return 0;
-}
-
-static int newconn(int conn,struct timeval *to,void *data)
-{
-	struct soap	*soap = (struct soap *) data;
-	glite_gsplugin_Context	plugin_ctx;
-
-	gss_cred_id_t		newcred = GSS_C_NO_CREDENTIAL;
-	edg_wll_GssStatus	gss_code;
-	gss_name_t		client_name = GSS_C_NO_NAME;
-	gss_buffer_desc		token = GSS_C_EMPTY_BUFFER;
-	OM_uint32		maj_stat,min_stat;
-
-
-	int	ret = 0;
-
-	soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE);
-	soap_set_namespaces(soap,jpps__namespaces);
-	soap->user = (void *) ctx; /* XXX: one instance per slave */
-
-/* not yet: client to JP index
-	ctx->other_soap = soap_new();
-	soap_init(ctx->other_soap);
-	soap_set_namespaces(ctx->other_soap,jpis__namespaces);
-*/
-
-
-	glite_gsplugin_init_context(&plugin_ctx);
-	plugin_ctx->connection = calloc(1,sizeof *plugin_ctx->connection);
-	soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx);
-
-	switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) {
-		case 0: break;
-		case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key,
-						&newcred,NULL,&gss_code))
-			{
-
-				printf("[%d] reloading credentials\n",getpid()); /* XXX: log */
-				gss_release_cred(&min_stat,&mycred);
-				mycred = newcred;
-			}
-			break;
-		case -1:
-			printf("[%d] edg_wll_gss_watch_creds failed\n", getpid()); /* XXX: log */
-			break;
-	}
-
-	/* TODO: DNS paranoia etc. */
-
-	if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) {
-		printf("[%d] GSS connection accept failed, closing.\n", getpid());
-		ret = 1;
-		goto cleanup;
-	}
-
-	maj_stat = gss_inquire_context(&min_stat,plugin_ctx->connection->context,
-			&client_name, NULL, NULL, NULL, NULL, NULL, NULL);
-
-	if (!GSS_ERROR(maj_stat))
-		maj_stat = gss_display_name(&min_stat,client_name,&token,NULL);
-
-	if (ctx->peer) free(ctx->peer);
-	if (!GSS_ERROR(maj_stat)) {
-		printf("[%d] client DN: %s\n",getpid(),(char *) token.value); /* XXX: log */
-
-		ctx->peer = strdup(token.value);
-		memset(&token, 0, sizeof(token));
-	}
-	else {
-		printf("[%d] annonymous client\n",getpid());
-		ctx->peer = NULL;
-	}
-
-	if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
-	if (token.value) gss_release_buffer(&min_stat, &token);
-
-	return 0;
-
-cleanup:
-	glite_gsplugin_free_context(plugin_ctx);
-	soap_end(soap);
-
-	return ret;
-}
-
-static int request(int conn,struct timeval *to,void *data)
-{
-	struct soap		*soap = data;
-	glite_jp_context_t	ctx = soap->user;
-
-	glite_gsplugin_set_timeout(glite_gsplugin_get_context(soap),to);
-
-/* FIXME: does not work, ask nykolas */
-	soap->max_keep_alive = 1;	/* XXX: prevent gsoap to close connection */ 
-	soap_begin(soap);
-	if (soap_begin_recv(soap)) {
-		if (soap->error < SOAP_STOP) {
-			soap_send_fault(soap);
-			return EIO;
-		}
-		return ENOTCONN;
-	}
-
-	if (soap_envelope_begin_in(soap)
-		|| soap_recv_header(soap)
-		|| soap_body_begin_in(soap)
-		|| jpps__serve_request(soap)
-#if GSOAP_VERSION >= 20700
-		|| (soap->fserveloop && soap->fserveloop(soap))
-#endif
-	)
-	{
-		soap_send_fault(soap);
-		return ctx->error->code;	/* XXX: shall we die on some errors? */
-	}
-
-	glite_jp_run_deferred(ctx);
-	return 0;
-}
-
-static int reject(int conn)
-{
-	int	flags = fcntl(conn, F_GETFL, 0);
-
-	fcntl(conn,F_SETFL,flags | O_NONBLOCK);
-	edg_wll_gss_reject(conn);
-
-	return 0;
-}
-
-static int disconn(int conn,struct timeval *to,void *data)
-{
-	struct soap	*soap = (struct soap *) data;
-	soap_end(soap); // clean up everything and close socket
-
-	return 0;
-}
-
-#define WSPACE "\t\n "
-
-static int call_opts(glite_jp_context_t ctx,char *opt,char *name,int (*f)(glite_jp_context_t,int,char **))
-{
-	int	ac = 1,ret,my_optind; 
-	char	**av = malloc(sizeof *av),*ap;
-
-	*av = name;
-	for (ap = strtok(opt,WSPACE); ap; ap = strtok(NULL,WSPACE)) {
-		av = realloc(av,(ac+1) * sizeof *av);
-		av[ac++] = ap;
-	}
-
-	my_optind = optind;
-	optind = 0;
-	ret = f(ctx,ac,av);
-	optind = my_optind;
-	free(av);
-	return ret;
-}
-
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
diff --git a/org.glite.jp.client/src/builtin_plugins.h b/org.glite.jp.client/src/builtin_plugins.h
deleted file mode 100644
index 3b2c201..0000000
--- a/org.glite.jp.client/src/builtin_plugins.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#define GLITE_JP_FILETYPE_TAGS	"urn:org.glite.jp.primary:tags"
-#define GLITE_JP_FILETYPE_LB	"urn:org.glite.jp.primary:lb"
-#define GLITE_JP_FILETYPE_ISB	"urn:org.glite.jp.primary:isb"
-#define GLITE_JP_FILETYPE_OSB	"urn:org.glite.jp.primary:osb"
-
-#define GLITE_JP_FPLUG_TAGS_APPEND	0
diff --git a/org.glite.jp.client/src/db.h b/org.glite.jp.client/src/db.h
deleted file mode 100644
index 0b9f730..0000000
--- a/org.glite.jp.client/src/db.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _DB_H
-#define _DB_H
-
-#ident "$Header$"
-
-#include 
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct _glite_jp_db_stmt_t *glite_jp_db_stmt_t;
-
-int glite_jp_db_connect(
-	glite_jp_context_t,	/* INOUT: */
-	char *		/* IN: connect string user/password@host:database */
-);
-
-void glite_jp_db_close(glite_jp_context_t);
-
-
-/* Parse and execute SQL statement. Returns number of rows selected, created 
- * or affected by update, or -1 on error */
-
-int glite_jp_db_execstmt(
-	glite_jp_context_t,	/* INOUT: */
-	char *,		/* IN: SQL statement */
-	glite_jp_db_stmt_t *	/* OUT: statement handle. Usable for
-					select only */
-);
-
-
-/* Fetch next row of select statement. 
- * All columns are returned as fresh allocated strings 
- *
- * return values:
- * 	>0 - number of fields of the retrieved row
- * 	 0 - no more rows
- * 	-1 - error
- *
- * Errors are stored in context passed to previous glite_jp_db_execstmt() */
-
-int glite_jp_db_fetchrow(
-	glite_jp_db_stmt_t,	/* IN: statement */
-	char **		/* OUT: array of fetched values. 
-			 *      As number of columns is fixed and known,
-			 *      expects allocated array of pointers here */
-);
-
-/* Retrieve column names of a query statement */
-
-int glite_jp_db_querycolumns(
-	glite_jp_db_stmt_t,	/* IN: statement */
-	char **		/* OUT: result set column names. Expects allocated array. */
-);
-
-/* Free the statement structure */
-
-void glite_jp_db_freestmt(
-	glite_jp_db_stmt_t *    /* INOUT: statement */
-);
-
-
-/* convert time_t into database-specific time string 
- * returns pointer to static area that is changed by subsequent calls */
-
-char *glite_jp_db_timetodb(time_t);
-time_t glite_jp_db_dbtotime(char *);
-
-
-/**
- * Check database version.
- */
-int glite_jp_db_dbcheckversion(glite_jp_context_t);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/org.glite.jp.client/src/feed.c b/org.glite.jp.client/src/feed.c
deleted file mode 100644
index 5d39565..0000000
--- a/org.glite.jp.client/src/feed.c
+++ /dev/null
@@ -1,327 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/strmd5.h"
-#include "feed.h"
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-
-
-/* 
- * seconds before feed expires: should be 
- * XXX: should be configurable, default for real deployment sort of 1 hour
- */
-#define FEED_TTL	120
-
-static int check_qry_item(
-		glite_jp_context_t ctx,
-		const glite_jp_query_rec_t    *qry,
-		const glite_jp_attrval_t *attr
-)
-{
-	int	cmp,cmp2;
-	long	scmp,ucmp;
-
-	switch (qry->attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-		case GLITE_JP_ATTR_TAG:
-			cmp = strcmp(attr->value.s,qry->value.s);
-			break;
-		case GLITE_JP_ATTR_TIME:
-			scmp = (ucmp = attr->value.time.tv_usec - qry->value.time.tv_usec) > 0 ? 0 : -1;
-			ucmp -= 1000000 * scmp;
-			scmp += attr->value.time.tv_sec - qry->value.time.tv_sec;
-			cmp = scmp ? scmp : ucmp;
-			break;
-	}
-	switch (qry->op) {
-		case GLITE_JP_QUERYOP_EQUAL: return !cmp;
-		case GLITE_JP_QUERYOP_UNEQUAL: return cmp;
-		case GLITE_JP_QUERYOP_LESS: return cmp < 0;
-		case GLITE_JP_QUERYOP_GREATER: return cmp > 0;
-
-		case GLITE_JP_QUERYOP_WITHIN:
-			switch (qry->attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-			case GLITE_JP_ATTR_TAG:
-				cmp2 = strcmp(attr->value.s,qry->value2.s);
-				break;
-			case GLITE_JP_ATTR_TIME:
-				scmp = (ucmp = attr->value.time.tv_usec - qry->value2.time.tv_usec) > 0 ? 0 : -1;
-				ucmp -= 1000000 * scmp;
-				scmp += attr->value.time.tv_sec - qry->value2.time.tv_sec;
-				cmp2 = scmp ? scmp : ucmp;
-				break;
-			}
-			return cmp >= 0 && cmp2 <= 0;
-	}
-}
-
-/* XXX: limit on query size -- I'm lazy to malloc() */
-#define QUERY_MAX	100
-
-static int match_feed(
-		glite_jp_context_t ctx,
-		const struct jpfeed *feed,
-		const char *job,
-		const glite_jp_attrval_t attrs[] /* XXX: not checked for correctness */
-)
-{
-	int	i;
-	int	attri[GLITE_JP_ATTR__LAST];
-	int	qi[QUERY_MAX];
-
-	glite_jp_attrval_t *newattr = NULL;
-
-	glite_jp_clear_error(ctx);
-
-	for (i=0; iqry) {
-		int	j,complete = 1;
-
-		memset(qi,0,sizeof qi);
-		for (i=0; feed->qry[i].attr.type; i++) {
-			assert(iqry[i].attr.type]) >=0) {
-				if (check_qry_item(ctx,feed->qry+i,attrs+j))
-					qi[i] = 1; /* matched */
-				else return 0;  /* can't be satisfied */
-			}
-			else complete = 0;
-		}
-
-		/* not all attributes in query are known from input 
-		 * we have to retrieve job metadata from the backend
-		 */
-		if (!complete) {
-			glite_jp_attrval_t	meta[GLITE_JP_ATTR__LAST+1];
-			int	qai[GLITE_JP_ATTR__LAST];
-
-			memset(meta,0,sizeof meta);
-			j=0;
-			for (i=0; feed->qry[i].attr.type; i++) if (!qi[i]) {
-				meta[j].attr.type = feed->qry[i].attr.type;
-				meta[j].attr.name = feed->qry[i].attr.name;
-				qai[feed->qry[i].attr.type] = i;
-				j++;
-			}
-
-			if (glite_jppsbe_get_job_metadata(ctx,job,meta)) {
-				glite_jp_error_t	err;
-				memset(&err,0,sizeof err);
-				err.code = EIO;
-				err.source = __FUNCTION__;
-				err.desc = "complete query";
-				return glite_jp_stack_error(ctx,&err);
-			}
-
-			for (i=0; j=meta[i].attr.type; i++)
-				if (!check_qry_item(ctx,feed->qry+qai[j],meta+i))
-					return 0;
-		}
-	}
-
-	/* matched completely */
-	return glite_jpps_single_feed(ctx,feed->destination,job,attrs);
-	return 0;
-}
-
-int glite_jpps_match_attr(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t attrs[]
-)
-{
-	struct jpfeed	*f = (struct jpfeed *) ctx->feeds;
-	int	i,j;
-	int 	attri[GLITE_JP_ATTR__LAST];
-
-	glite_jp_clear_error(ctx);
-
-	for (i=0; i= GLITE_JP_ATTR__LAST ||
-				attrs[i].attr.type <= 0)
-		{
-			glite_jp_error_t	err;
-			memset(&err,0,sizeof err);
-			err.code = EINVAL;
-			err.source = __FUNCTION__;
-			err.desc = "unknown attribute";
-			return glite_jp_stack_error(ctx,&err);
-		}
-		if (attri[attrs[i].attr.type] >= 0) {
-			glite_jp_error_t	err;
-			memset(&err,0,sizeof err);
-			err.code = EINVAL;
-			err.source = __FUNCTION__;
-			err.desc = "double attribute change";
-			return glite_jp_stack_error(ctx,&err);
-		}
-
-		attri[attrs[i].attr.type] = i;
-	}
-
-	for (;f; f = f->next) {
-		for (i=0; f->attrs[i].type && attri[f->attrs[i].type] == -1; i++);
-		/* XXX: ignore any errors */
-		if (f->attrs[i].type) match_feed(ctx,f,job,attrs);
-	}
-
-	return glite_jp_clear_error(ctx);
-}
-
-int glite_jpps_match_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name
-)
-{
-	glite_jpps_fplug_data_t	**pd = NULL;
-	int	pi;
-	void	*bh = NULL;
-	int	ret;
-
-	fprintf(stderr,"%s: %s %s %s\n",__FUNCTION__,job,class,name);
-
-	switch (glite_jpps_fplug_lookup(ctx,class,&pd)) {
-		case ENOENT: return 0;	/* XXX: shall we complain? */
-		case 0: break;
-		default: return -1;
-	}
-
-	for (pi=0; pd[pi]; pi++) {
-		int	ci;
-		for (ci=0; pd[pi]->uris[ci]; ci++) if (!strcmp(pd[pi]->uris[ci],class)) {
-			void	*ph;
-
-			if (!bh && (ret = glite_jppsbe_open_file(ctx,job,pd[pi]->classes[ci],name,O_RDONLY,&bh))) {
-				free(pd);
-				return ret;
-			}
-
-			if (pd[pi]->ops.open(pd[pi]->fpctx,bh,class,&ph)) {
-				/* XXX: complain more visibly */
-				fputs("plugin open failed\n",stderr);
-				continue;
-			}
-
-			/* XXX: does not belong here but I'd like to avoid opening the file twice */
-			if (!strcmp(class,GLITE_JP_FILETYPE_LB)) {
-				glite_jp_attr_t		owner = { GLITE_JP_ATTR_OWNER, NULL };
-				glite_jp_attrval_t	*val;
-
-				switch (pd[pi]->ops.attr(pd[pi]->fpctx,ph,owner,&val)) {
-					case ENOENT:
-					case ENOSYS: abort();
-					case 0: printf("LB plugin: owner = %s\n",val[0].value.s);
-						/* TODO: store it in backend */
-
-						glite_jp_attrval_free(val,1);
-						break;
-
-					default: /* TODO: complain */; break;
-				}
-			}
-
-			/* TODO: extract attributes for the feeds */
-
-
-			pd[pi]->ops.close(pd[pi]->fpctx,ph);
-		}
-	}
-
-	if (bh) glite_jppsbe_close_file(ctx,bh);
-	free(pd);
-
-	return 0;
-}
-
-int glite_jpps_match_tag(
-	glite_jp_context_t ctx,
-	const char *job,
-	const glite_jp_tagval_t *tag
-)
-{
-	fprintf(stderr,"%s: \n",__FUNCTION__);
-	return 0;
-}
-
-static char *generate_feedid(void)
-{
-	char	hname[200],buf[1000];
-
-	gethostname(hname,sizeof hname);
-	snprintf(buf,sizeof buf,"%s%d%ld",hname,getpid(),lrand48());
-	buf[sizeof buf-1] = 0;
-	return str2md5base64(buf);
-}
-
-
-int glite_jpps_run_feed(
-	glite_jp_context_t ctx,
-	const char *destination,
-	const glite_jp_attr_t *attrs,
-	const glite_jp_query_rec_t *qry,
-	char **feed_id)
-{
-	fprintf(stderr,"%s: \n",__FUNCTION__);
-	return 0;
-}
-
-static int register_feed_deferred(glite_jp_context_t ctx,void *feed)
-{
-	struct jpfeed	*f = feed;
-
-	f->next = ctx->feeds;
-	ctx->feeds = f;
-	return 0;
-}
-
-/* FIXME:
- * - volatile implementation: should store the registrations in a file
- *   and recover after restart
- * - should communicate the data among all server slaves
- */
-int glite_jpps_register_feed(
-	glite_jp_context_t ctx,
-	const char *destination,
-	const glite_jp_attr_t *attrs,
-	const glite_jp_query_rec_t *qry,
-	char **feed_id,
-	time_t *expires)
-{
-	int	i;
-	struct jpfeed	*f = calloc(1,sizeof *f);
-
-	if (!*feed_id) *feed_id = generate_feedid();
-	time(expires); *expires += FEED_TTL;
-
-	f->id = strdup(*feed_id);
-	f->destination = strdup(destination);
-	f->expires = *expires;
-	for (i=0; attrs[i].type; i++) {
-		f->attrs = realloc(f->attrs,(i+2) * sizeof *f->attrs);
-		glite_jp_attr_copy(f->attrs+i,attrs+i);
-		memset(f->attrs+i+1,0,sizeof *f->attrs);
-	}
-	for (i=0; qry[i].attr.type; i++) {
-		f->qry = realloc(f->qry,(i+2) * sizeof *f->qry);
-		glite_jp_queryrec_copy(f->qry+i,qry+i);
-		memset(f->qry+i+1,0,sizeof *f->qry);
-	}
-
-	glite_jp_add_deferred(ctx,register_feed_deferred,f);
-
-	return 0;
-}
-
diff --git a/org.glite.jp.client/src/feed.h b/org.glite.jp.client/src/feed.h
deleted file mode 100644
index c3c2461..0000000
--- a/org.glite.jp.client/src/feed.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __GLITE_JP_FEED
-#define __GLITE_JP_FEED
-
-
-struct jpfeed {
-	char	*id,*destination;
-	time_t	expires;
-	glite_jp_attr_t	*attrs;
-	glite_jp_query_rec_t	*qry;
-	struct jpfeed	*next;
-};
-
-
-int glite_jpps_match_attr(glite_jp_context_t,const char *,const glite_jp_attrval_t[]);
-int glite_jpps_match_file(glite_jp_context_t,const char *,const char *,const char *);
-int glite_jpps_match_tag(glite_jp_context_t,const char *,const glite_jp_tagval_t *);
-int glite_jpps_run_feed(glite_jp_context_t,const char *,const glite_jp_attr_t *,const glite_jp_query_rec_t *,char **);
-int glite_jpps_register_feed(glite_jp_context_t,const char *,const glite_jp_attr_t *,const glite_jp_query_rec_t *,char **,time_t *);
-
-#endif
-
diff --git a/org.glite.jp.client/src/file_plugin.c b/org.glite.jp.client/src/file_plugin.c
deleted file mode 100644
index 144a231..0000000
--- a/org.glite.jp.client/src/file_plugin.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include "file_plugin.h"
-
-static struct option opts[] = {
-	{ "plugin", 1, NULL, 'p' },
-	{ NULL }
-};
-
-static int loadit(glite_jp_context_t ctx,const char *so)
-{
-/* XXX: not stored but we never dlclose() yet */
-	void	*dl_handle = dlopen(so,RTLD_NOW);
-
-	glite_jp_error_t	err;
-	const char	*e;
-	glite_jpps_fplug_data_t	*data,*dp;
-	int	i;
-
-	glite_jpps_fplug_init_t	init;
-	memset(&err,0,sizeof err);
-
-	if (!dl_handle) {
-		err.source = "dlopen()";
-		err.code = EINVAL;
-		err.desc = dlerror();
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	dlerror();
-	init = dlsym(dl_handle,"init");
-	e = dlerror();
-	if (e) {
-		char	buf[300];
-		snprintf(buf,sizeof buf,"dlsym(\"%s\",\"init\")",so);
-		buf[299] = 0;
-		err.source = buf;
-		err.code = ENOENT;
-		err.desc = e;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	data = calloc(1,sizeof *data);
-
-	if (init(ctx,data)) return -1;
-
-	i = 0;
-	if (ctx->plugins) for (i=0; ctx->plugins[i]; i++);
-	ctx->plugins = realloc(ctx->plugins, (i+2) * sizeof *ctx->plugins);
-	ctx->plugins[i] = data;
-	ctx->plugins[i+1] = NULL;
-
-	/* TODO: check consistency of uri+class pairs wrt. previous plugins */
-	
-	return 0;
-}
-
-int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv)
-{
-	int	i;
-
-	for (i=1; iplugins) {
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	for (i = 0; ctx->plugins[i]; i++) {
-		int	j;
-		glite_jpps_fplug_data_t	*p = ctx->plugins[i];
-
-		for (j=0; p->uris && p->uris[j]; j++)
-			if (!strcmp(p->uris[j],uri)) {
-				out = realloc(out, (matches+2) * sizeof *out);
-				out[matches++] = p;
-				out[matches] = NULL;
-			}
-	}
-
-	if (matches) {
-		*plugin_data = out;
-		return 0;
-	}
-	else return glite_jp_stack_error(ctx,&err);
-}
-
diff --git a/org.glite.jp.client/src/ftp_backend.c b/org.glite.jp.client/src/ftp_backend.c
deleted file mode 100644
index 8bf523b..0000000
--- a/org.glite.jp.client/src/ftp_backend.c
+++ /dev/null
@@ -1,1744 +0,0 @@
-#ident "$Header$"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-
-#include "tags.h"
-#include "backend.h"
-
-#define UPLOAD_SUFFIX ".upload"
-#define LOCK_SUFFIX ".lock"
-
-struct ftpbe_config {
-	char *internal_path;
-	char *external_path;
-	char *gridmap;
-	char *logname;
-};
-
-static struct ftpbe_config *config = NULL;
-
-struct fhandle_rec {
-	int fd;
-	int fd_append;
-};
-typedef struct fhandle_rec *fhandle;
-
-static struct option ftpbe_opts[] = {
-	{ "ftp-internal-path", 1, NULL, 'I' },
-	{ "ftp-external-path", 1, NULL,	'E' },
-	{ "ftp-gridmap",       1, NULL,	'G' },
-	{ NULL,                0, NULL,  0  }
-};
-
-/* obsolete */
-#if 0
-static struct {
-	glite_jp_fileclass_t	type;
-	char *			fname;
-	} class_to_fname_tab[] = {
-		{ GLITE_JP_FILECLASS_INPUT,  "input" },
-		{ GLITE_JP_FILECLASS_OUTPUT, "output" },
-		{ GLITE_JP_FILECLASS_LBLOG,  "lblog" },
-		{ GLITE_JP_FILECLASS_TAGS,   "tags" },
-		{ GLITE_JP_FILECLASS_UNDEF,  NULL }
-	};
-
-static char *class_to_fname(glite_jp_fileclass_t type)
-{
-	int i;
-
-	for (i = 0; class_to_fname_tab[i].type != GLITE_JP_FILECLASS_UNDEF; i++)
-		if (type == class_to_fname_tab[i].type)
-			return class_to_fname_tab[i].fname;
-
-	return NULL;
-}
-
-static glite_jp_fileclass_t fname_to_class(char* fname)
-{
-	int i;
-
-	for (i = 0; class_to_fname_tab[i].type != GLITE_JP_FILECLASS_UNDEF; i++)
-		if (!strcmp(fname, class_to_fname_tab[i].fname))
-			return class_to_fname_tab[i].type;
-
-	return GLITE_JP_FILECLASS_UNDEF;
-}
-#endif
-
-static int config_check(
-	glite_jp_context_t ctx,
-	struct ftpbe_config *config)
-{
-	return config == NULL ||
-		config->internal_path == NULL ||
-		config->external_path == NULL ||
-		config->gridmap == NULL ||
-		config->logname == NULL;
-
-	/* XXX check reality */
-}
-
-static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job, 
-			  char **unique, char **ju_path, int get_path)
-{
-	char *p;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	p = strrchr(job, '/');
-	if (!p) {
-		err.code = EINVAL;
-		err.desc = "Malformed jobid";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	/* XXX thorough checks */
-	if (!(*unique = strdup(p+1))) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (get_path) {
-		if (!(*ju_path = strdup(p+1))) {
-			free(*unique);
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		*(*ju_path + 10) = '\0';
-	}
-	return 0;
-}
-
-static int mkdirpath(const char* path, int prefixlen)
-{
-	char *wpath, *p;
-	int goout, ret;
-
-	wpath = strdup(path);
-	if (!wpath) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	p = wpath + prefixlen;
-	goout = 0;
-	while (!goout) {
-		while (*p == '/') p++;
-		while (*p != '/' && *p != '\0') p++;
-		goout = (*p == '\0');
-		*p = '\0';
-		ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR);
-		if (ret < 0 && errno != EEXIST) break;
-		*p = '/';
-	}
-	free(wpath);
-	return goout ? 0 : ret;
-}
-
-static long regtime_trunc(long tv_sec)
-{
-	return tv_sec / (86400*7);
-}
-
-static long regtime_ceil(long tv_sec)
-{
-	return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ;
-}
-
-/********************************************************************************/
-int glite_jppsbe_init(
-	glite_jp_context_t ctx,
-	int argc,
-	char *argv[]
-)
-{
-	glite_jp_error_t err;
-	int opt;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	config = (struct ftpbe_config *) calloc(1, sizeof *config);
-	if (!config) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	config->logname = getlogin();
-
-	while ((opt = getopt_long(argc, argv, "I:E:G:", ftpbe_opts, NULL)) != EOF) {
-		switch (opt) {
-			case 'I': config->internal_path = optarg; break;
-			case 'E': config->external_path = optarg; break;
-			case 'G': config->gridmap = optarg; break;
-			default: break;
-		}
-	}
-
-	if (config_check(ctx, config)) {
-		err.code = EINVAL;
-		err.desc = "Invalid FTP backend configuration";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_init_slave(
-	glite_jp_context_t ctx
-)
-{
-	/* Nothing to do */
-}
-
-int glite_jppsbe_register_job(	
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *owner
-)
-{
-	glite_jp_error_t err;
-	char *int_dir = NULL;
-	char *int_fname = NULL;
-	char *data_dir = NULL;
-	char *data_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *ownerhash = NULL;
-	FILE *regfile = NULL;
-	struct timeval reg_tv;
-	long reg_tv_trunc;
-	struct stat statbuf;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job != NULL);
-	assert(owner != NULL);
-
-	gettimeofday(®_tv, NULL);
-	reg_tv_trunc = regtime_trunc(reg_tv.tv_sec);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_dir, "%s/regs/%s",
-			config->internal_path, ju_path) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (mkdirpath(int_dir, strlen(config->internal_path)) < 0 &&
-			errno != EEXIST) {
-		free(int_dir);
-		err.code = errno;
-		err.desc = "Cannot mkdir jobs's reg directory";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	free(int_dir);
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (stat(int_fname, &statbuf) < 0) {
-		if (errno != ENOENT) {
-			err.code = errno;
-			err.desc = "Cannot stat jobs's reg info file";
-			goto error_out;
-		}
-	} else {
-		err.code = EEXIST;
-		err.desc = "Job already registered";
-		goto error_out;
-	}
-
-	regfile = fopen(int_fname, "w");
-	if (regfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-
-	ownerhash = str2md5(owner); /* static buffer */
-	
-	if (fprintf(regfile, "%d %ld.%06ld %s %s %d %s\n", 1,
-		(long)reg_tv.tv_sec, (long)reg_tv.tv_usec, job,
-		ownerhash, strlen(owner), owner) < 1 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot write jobs's reg info file";
-		goto error_out;
-	}
-	if (fclose(regfile) != 0 ) {
-		err.code = errno;
-		err.desc = "Cannot close(write) jobs's reg info file";
-		goto error_out;
-	}
-
-	if (asprintf(&data_dir, "%s/data/%s/%d/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (asprintf(&data_fname, "%s/_info", data_dir) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 &&
-			errno != EEXIST) {
-		err.code = errno;
-		err.desc = "Cannot mkdir jobs's data directory";
-		goto error_out;
-	}
-
-	if (link(int_fname, data_fname) < 0) {
-		err.code = errno;
-		err.desc = "Cannot link job's reg and data info files";
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(data_fname);
-	if (err.code && data_dir) rmdir(data_dir);
-	free(data_dir);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int add_to_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	gridmap = fopen(config->gridmap, "a");
-	if (!gridmap) {
-		err.code = errno;
-		err.desc = "Cannot open gridmap file";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 ||
-		ferror(gridmap)) {
-		err.code = EIO;
-		err.desc = "Cannot write to gridmap file";
-		fclose(gridmap);
-		return glite_jp_stack_error(ctx,&err);
-	}
-	fclose(gridmap);
-	return 0;
-}
-
-static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	char *temp_name = NULL;
-	FILE *temp_file = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	/* XXX */
-	return 0;
-}
-
-int glite_jppsbe_start_upload(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	/* TODO */
-	const char *content_type,
-	char **destination_out,
-	time_t *commit_before_inout
-)
-{
-	char *int_fname = NULL;
-	char *lock_fname = NULL;
-	FILE *lockfile = NULL;
-	FILE *regfile = NULL;
-	char *data_dir = NULL;
-	char *data_lock = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *peername = NULL;
-	int info_version;
-	long reg_time;
-	char ownerhash[33];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(destination_out!=NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	peername = glite_jp_peer_name(ctx);
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%*ld %*s %s ", &info_version,
-		®_time, ownerhash) < 3 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	fclose(regfile);
-
-	/* XXX authorization */
-
-	if (asprintf(&data_dir, "%s/data/%s/%d/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_time), ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(&lock_fname, "%s/%s" LOCK_SUFFIX,
-			data_dir, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (commit_before_inout != NULL)
-		*commit_before_inout = (time_t) LONG_MAX;  /* XXX no timeout enforced */
-
-	lockfile = fopen(lock_fname, "w");
-	if (lockfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open uploads's lock file";
-		goto error_out;
-	}
-
-	if (fprintf(lockfile, "%ld %d %s\n", (long)*commit_before_inout,
-		peername ? peername : 0,
-		peername ? peername : "") < 1 || ferror(regfile)) {
-		fclose(lockfile);
-		err.code = errno;
-		err.desc = "Cannot write upload's lock file";
-		goto error_out;
-	}
-	if (fclose(lockfile) != 0 ) {
-		err.code = errno;
-		err.desc = "Cannot close(write) upload's lock file";
-		goto error_out;
-	}
-
-	if (asprintf(destination_out, "%s/data/%s/%d/%s/%s" UPLOAD_SUFFIX,
-			config->external_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (add_to_gridmap(ctx, peername)) {
-		err.code = EIO;
-		err.desc = "Cannot add peer DN to ftp server authorization file";
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(data_dir);
-	if (err.code && data_lock) unlink(data_lock);
-	free(data_lock);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_commit_upload(
-	glite_jp_context_t ctx,
-	const char *destination
-)
-{
-	size_t dest_len;
-	size_t suff_len;
-	size_t extp_len;
-	long commit_before;
-	int lockpeerlen;
-	char *lockpeername = NULL;
-	char *peername = NULL;
-	char *dest_rw = NULL;
-	char *dest_rw_suff = NULL;
-	char *dest_rw_lock = NULL;
-	FILE *lockfile = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(destination != NULL);
-
-	suff_len = strlen(UPLOAD_SUFFIX);
-	dest_len = strlen(destination);
-	extp_len = strlen(config->external_path);
-
-	if (dest_len < suff_len ||
-		strcmp(UPLOAD_SUFFIX, destination + (dest_len - suff_len)) ||
-		strncmp(destination, config->external_path, extp_len)) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&dest_rw_suff, "%s%s", config->internal_path,
-		destination + extp_len) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	dest_rw = strdup(dest_rw_suff);
-	if (!dest_rw) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	*(dest_rw + (strlen(dest_rw_suff) - suff_len)) = '\0';
-
-	if (asprintf(&dest_rw_lock, "%s" LOCK_SUFFIX, dest_rw) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	lockfile = fopen(dest_rw_lock, "r");
-	if (lockfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open upload's lock file";
-		goto error_out;
-	}
-	if (fscanf(lockfile, "%ld %d ", &commit_before, &lockpeerlen) < 2 || ferror(lockfile)) {
-		fclose(lockfile);
-		err.code = errno;
-		err.desc = "Cannot read upload's lock file";
-		goto error_out;
-	}
-	if (lockpeerlen) {
-		lockpeername = (char*) calloc(1, lockpeerlen+1);
-		if (!lockpeername) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(lockpeername, lockpeerlen+1, lockfile) == NULL) {
-			fclose(lockfile);
-			err.code = errno;
-			err.desc = "Cannot read upload's lock file";
-			goto error_out;
-		}
-	}
-	fclose(lockfile);
-
-	peername = glite_jp_peer_name(ctx);
-	if (lockpeername && (!peername || strcmp(lockpeername, peername))) {
-		err.code = EPERM;
-		err.desc = "Upload started by client of different identity";
-		goto error_out;
-	}
-
-	if (rename(dest_rw_suff, dest_rw) < 0) {
-		err.code = errno;
-		err.desc = "Cannot move upload file to the final place";
-		goto error_out;
-	}
-
-	if (unlink(dest_rw_lock) < 0) {
-		err.code = errno;
-		err.desc = "Cannot unlink upload's lock file";
-		goto error_out;
-	}
-
-error_out:
-	free(dest_rw);
-	free(dest_rw_suff);
-	free(dest_rw_lock);
-	free(peername);
-	free(lockpeername);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_destination_info(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char **job,
-	char **class,
-	char **name
-)
-{
-	size_t dest_len;
-	size_t suff_len;
-	size_t extp_len;
-	char *dest_rw = NULL;
-	char *dest_rw_suff = NULL;
-	char *dest_rw_info = NULL;
-	FILE *infofile = NULL;
-	char *classname = NULL;
-	char jobstr[256+1];
-	glite_jp_error_t err;
-
-	assert(destination != NULL);
-	assert(job != NULL);
-	assert(class != NULL);
-	assert(name != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	suff_len = strlen(UPLOAD_SUFFIX);
-	dest_len = strlen(destination);
-	extp_len = strlen(config->external_path);
-
-	if (dest_len < suff_len ||
-		strcmp(UPLOAD_SUFFIX, destination + (dest_len - suff_len)) ||
-		strncmp(destination, config->external_path, extp_len)) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&dest_rw_suff, "%s%s", config->internal_path,
-		destination + extp_len) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	dest_rw = strdup(dest_rw_suff);
-	if (!dest_rw) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	*(dest_rw + (strlen(dest_rw_suff) - suff_len)) = '\0';
-
-	classname = strrchr(dest_rw,'/');
-	if (classname == NULL) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		goto error_out;
-	}
-	*classname++ ='\0';
-	*class = strdup(classname);
-
-/* XXX: do we need similar check? 
-	if (!class == GLITE_JP_FILECLASS_UNDEF) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		goto error_out;
-	}
-*/
-
-	/* TODO: */
-	*name = NULL;
-
-	if (asprintf(&dest_rw_info, "%s/_info", dest_rw) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	infofile = fopen(dest_rw_info, "r");
-	if (infofile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open _info file";
-		goto error_out;
-	}
-	if (fscanf(infofile, "%*d %*ld.%*ld %256s ", jobstr) < 1 || ferror(infofile)) {
-		fclose(infofile);
-		err.code = errno;
-		err.desc = "Cannot read _info file";
-		goto error_out;
-	}
-	*job = strdup(jobstr);
-	fclose(infofile);
-
-error_out:
-	free(dest_rw);
-	free(dest_rw_suff);
-	free(dest_rw_info);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-
-int glite_jppsbe_get_job_url(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	/* TODO */
-	char **url_out
-)
-{
-	FILE *regfile = NULL;
-	char *int_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	int info_version;
-	long reg_time;
-	char ownerhash[33];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(url_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%*ld %*s %s", &info_version,
-		®_time, ownerhash) < 3 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	fclose(regfile);
-
-	if (asprintf(url_out, "%s/data/%s/%d/%s/%s",
-			config->external_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int get_job_fname(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* TODO */
-	char **fname_out
-)
-{
-	FILE *regfile = NULL;
-	char *int_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	int info_version;
-	long reg_time;
-	char ownerhash[33];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(fname_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%*ld %*s %s", &info_version,
-		®_time, ownerhash) < 3 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	fclose(regfile);
-
-	if (asprintf(fname_out, "%s/data/%s/%d/%s/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_open_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* TODO */
-	int mode,
-	void **handle_out
-)
-{
-	fhandle	handle = NULL;
-	char* fname = NULL;
-	glite_jp_error_t err;
-
-	assert(handle_out != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (get_job_fname(ctx, job, class, name, &fname)) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot construct internal filename";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	handle = (fhandle) calloc(1,sizeof(*handle));
-	if (handle == NULL) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	handle->fd = open(fname, mode, S_IRUSR | S_IWUSR);
-	if (handle->fd < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file";
-		free(handle);
-		goto error_out;
-	}
-	handle->fd_append = open(fname, mode | O_APPEND, S_IRUSR | S_IWUSR);
-	if (handle->fd_append < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file for append";
-		close(handle->fd);
-		free(handle);
-		goto error_out;
-	}
-	*handle_out = (void*) handle;
-
-error_out:
-	free(fname);
-	if (err.code) { 
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_close_file(
-	glite_jp_context_t ctx,
-	void *handle
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (close(((fhandle)handle)->fd_append) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor (fd_append)";
-		goto error_out;
-	}
-	if (close(((fhandle)handle)->fd) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor";
-		goto error_out;
-	}
-
-error_out:
-	free(handle);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_pread(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset,
-	ssize_t *nbytes_ret
-)
-{
-	ssize_t ret;
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if ((ret = pread(((fhandle)handle)->fd, buf, nbytes, offset)) < 0) {
-		err.code = errno;
-		err.desc = "Error in pread()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	*nbytes_ret = ret;
-
-	return 0;
-}
-
-int glite_jppsbe_pwrite(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (pwrite(((fhandle)handle)->fd, buf, nbytes, offset) < 0) {
-		err.code = errno;
-		err.desc = "Error in pwrite()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (write(((fhandle)handle)->fd_append, buf, nbytes) < 0) {
-		err.code = errno;
-		err.desc = "Error in write()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-static int get_job_info(
-	glite_jp_context_t ctx,
-	const char *job,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	char *ju = NULL;
-	char *ju_path = NULL;
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char *int_fname = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %*s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, &ownerlen) < 4 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	free(int_fname);
-	free(ju);
-	free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-static int get_job_info_int(
-	glite_jp_context_t ctx,
-	const char *int_fname,
-	char **jobid,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char jobid_buf[256];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, jobid_buf, &ownerlen) < 5 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	*jobid = strdup(jobid_buf);
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_get_job_metadata(
-	glite_jp_context_t ctx,
-	const char *job,
-	glite_jp_attrval_t attrs_inout[]
-)
-{
-	int got_info = 0;
-	struct timeval tv_reg;
-	char *owner = NULL;
-	int got_tags = 0;
-	void *tags_handle = NULL;
-	glite_jp_tagval_t* tags = NULL;
-	int i,j;
-	glite_jp_error_t err;
-
-	assert(job != NULL);
-	assert(attrs_inout != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; attrs_inout[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (attrs_inout[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TIME:
-*/
-			if (!got_info) {
-				if (get_job_info(ctx, job, &owner, &tv_reg)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot retrieve job info";
-					goto error_out;
-				}
-				got_info = 1;
-			}
-			break;
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			if (!got_tags) {
-				if (glite_jppsbe_open_file(ctx, job, GLITE_JP_FILECLASS_TAGS,
-					O_RDONLY, &tags_handle)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot open tag file";
-					goto error_out;
-				}
-				if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot read tags";
-					glite_jppsbe_close_file(ctx, tags_handle);
-					goto error_out;
-				}
-				glite_jppsbe_close_file(ctx, tags_handle);
-				got_tags = 1;
-			}
-			break;
-*/
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type";
-			goto error_out;
-			break;
-		}
-
-		switch (attrs_inout[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-			attrs_inout[i].value.s = strdup(owner);
-			if (!attrs_inout[i].value.s) {
-				err.code = ENOMEM;
-				err.desc = "Cannot copy owner string";
-				goto error_out;
-			}	
-			break;
-		case GLITE_JP_ATTR_TIME:
-			attrs_inout[i].value.time = tv_reg;
-			break;
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			for (j = 0; tags[j].name != NULL; j++) {
-				if (!strcmp(tags[j].name, attrs_inout[i].attr.name)) {
-					if (glite_jpps_tagval_copy(ctx, &tags[j],
-						&attrs_inout[i].value.tag)) {
-						err.code = ENOMEM;
-						err.desc = "Cannot copy tag value";
-						goto error_out;
-					}
-					break;
-				}
-			}
-			if (!tags[j].name) attrs_inout[i].value.tag.name = NULL;
-			break;
-*/
-		default:
-			break;
-		}
-	}
-
-error_out:
-	free(owner);
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	free(tags);
-	
-	if (err.code) {
-		while (i > 0) {
-			i--;
-			switch (attrs_inout[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				free(attrs_inout[i].value.s);
-				break;
-			case GLITE_JP_ATTR_TAG:
-				free(attrs_inout[i].value.tag.name);
-				free(attrs_inout[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-static int compare_timeval(struct timeval a, struct timeval b)
-{
-	if (a.tv_sec < b.tv_sec) return -1;
-	if (a.tv_sec > b.tv_sec) return 1;
-	if (a.tv_usec < b.tv_usec) return -1;
-	if (a.tv_usec > b.tv_usec) return 1;
-	return 0;
-}
-
-
-/* FIXME: disabled -- clarification wrt. filetype plugin needed */
-
-#if 0
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-);
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	char *time_dirname = NULL;
-	DIR *time_dirp = NULL;
-	struct dirent *jobent;
-	char *info_fname = NULL;
-	char *jobid = NULL;
-	char *owner = NULL;
-	struct timeval tv_reg;
-	void *tags_handle = NULL;
-	int matching;
-	int i, j;
-	glite_jp_tagval_t* tags = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (asprintf(&time_dirname, "%s/data/%s/%d", config->internal_path,
-			ownerhash, regtime_tr) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	time_dirp = opendir(time_dirname);
-	if (!time_dirp) {
-		free(time_dirname);
-		return 0; /* found nothing */
-	}
-	while ((jobent = readdir(time_dirp)) != NULL) {
-		if (!strcmp(jobent->d_name, ".")) continue;
-		if (!strcmp(jobent->d_name, "..")) continue;
-		if (asprintf(&info_fname, "%s/%s/_info", time_dirname,
-				jobent->d_name) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (get_job_info_int(ctx, info_fname, &jobid, &owner,  &tv_reg)) {
-			err.code = EIO;
-			err.desc = "Cannot retrieve job info";
-			goto error_out;
-		}
-		if (q_tags || md_tags) {
-			if (glite_jppsbe_open_file(ctx, jobid, GLITE_JP_FILECLASS_TAGS,
-				O_RDONLY, &tags_handle)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot open tag file";
-				goto error_out;
-			}
-			if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot read tags";
-				glite_jppsbe_close_file(ctx, tags_handle);
-				goto error_out;
-			}
-			glite_jppsbe_close_file(ctx, tags_handle);
-			tags_handle = NULL;
-		}
-
-		matching = 1;
-		for (i = 0; matching && query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (query[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				if (query[i].value.s == NULL || 
-					strcmp(query[i].value.s, owner)) matching = 0;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				switch (query[i].op) {
-					case GLITE_JP_QUERYOP_EQUAL:
-						matching = !compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_UNEQUAL:
-						matching = compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_LESS:
-						matching = compare_timeval(tv_reg, query[i].value.time) < 0;
-						break;
-					case GLITE_JP_QUERYOP_GREATER:
-						matching = compare_timeval(tv_reg, query[i].value.time) > 0;
-						break;
-					case GLITE_JP_QUERYOP_WITHIN:
-						matching = compare_timeval(tv_reg, query[i].value.time) >= 0
-							&& compare_timeval(tv_reg, query[i].value2.time) <= 0;
-						break;
-				}
-				break;
-			case GLITE_JP_ATTR_TAG:
-				if (!tags) {
-					matching = 0;
-					break;
-				}
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, query[i].attr.name)) {
-						switch (query[i].op) {
-						case GLITE_JP_QUERYOP_EQUAL:
-							matching = !strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_UNEQUAL:
-							matching = strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_LESS:
-							matching = strcmp(tags[j].value, query[i].value.s) < 0;
-							break;
-						case GLITE_JP_QUERYOP_GREATER:
-							matching = strcmp(tags[j].value, query[i].value.s) > 0;
-							break;
-						case GLITE_JP_QUERYOP_WITHIN:
-							matching = strcmp(tags[j].value, query[i].value.s) >= 0 \
-								&& strcmp(tags[j].value, query[i].value2.s) <= 0 ;
-							break;
-						default:
-							break;
-						}
-					}
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		if (!matching) {
-			free(info_fname); info_fname = NULL;
-			free(jobid); jobid = NULL;
-			if (tags) for (j = 0; tags[j].name != NULL; j++) {
-				free(tags[j].name);
-				free(tags[j].value);
-			}
-			free(tags); tags = NULL;
-			continue;
-		}
-
-		for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				metadata[i].value.s = owner;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				metadata[i].value.time = tv_reg;
-				break;
-			case GLITE_JP_ATTR_TAG:
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, metadata[i].attr.name)) {
-						if (glite_jpps_tagval_copy(ctx, &tags[j],
-							&metadata[i].value.tag)) {
-							err.code = ENOMEM;
-							err.desc = "Cannot copy tag value";
-							goto error_out;
-						}
-						break;
-					}
-				}
-				if (!tags[j].name) {
-					metadata[i].value.tag.name = NULL;
-					metadata[i].value.tag.value = NULL;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		(*callback)(ctx, jobid, metadata);
-		free(jobid); jobid = NULL;
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-	}
-
-error_out:
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	if (tags_handle) glite_jppsbe_close_file(ctx, tags_handle);
-	free(info_fname);
-	free(owner);
-	free(jobid);
-	closedir(time_dirp);
-	free(time_dirname);
-	if (err.code)  {
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else
-		return 0;
-}
-
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	/* XXX clone metadata */
-	int i;
-	char *q_exact_owner = NULL;
-	char *ownerhash = NULL;
-	long q_min_time = 0;
-	long q_max_time = LONG_MAX;
-	long q_min_time_tr;
-	long q_max_time_tr;
-	int q_with_tags = 0;
-	int md_info = 0;
-	int md_tags = 0;
-	char *owner_dirname = NULL;
-	DIR *owner_dirp = NULL;
-	struct dirent *ttimeent;
-	char *data_dirname = NULL;
-	DIR *data_dirp = NULL;
-	struct dirent *ownerent;
-	long ttime = 0;
-	glite_jp_attrval_t *metadata_templ = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		if (query[i].attr.type == GLITE_JP_ATTR_OWNER && query[i].op == GLITE_JP_QUERYOP_EQUAL) {
-			q_exact_owner = query[i].value.s;
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TIME) {
-			switch (query[i].op) {
-			case GLITE_JP_QUERYOP_EQUAL:
-				q_min_time = query[i].value.time.tv_sec;
-				q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_LESS:
-				if (q_max_time > query[i].value.time.tv_sec + 1)
-					q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_WITHIN:
-				if (q_max_time > query[i].value2.time.tv_sec + 1)
-					q_max_time = query[i].value2.time.tv_sec + 1;
-				/* fallthrough */
-			case GLITE_JP_QUERYOP_GREATER:
-				if (q_min_time < query[i].value.time.tv_sec)
-					q_min_time = query[i].value.time.tv_sec;
-				break;
-			default:
-				err.code = EINVAL;
-				err.desc = "Invalid query op";
-				return glite_jp_stack_error(ctx,&err);
-				break;
-			}
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TAG) 
-			q_with_tags = 1;
-
-	}
-
-	for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (metadata[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-		case GLITE_JP_ATTR_TIME:
-			md_info = 1;
-			break;
-		case GLITE_JP_ATTR_TAG:
-			md_tags = 1;
-			break;
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type in metadata parameter";
-			return glite_jp_stack_error(ctx,&err);
-			break;
-		}
-	}
-	metadata_templ = (glite_jp_attrval_t *) calloc(i + 1, sizeof(glite_jp_attrval_t));
-	if (!metadata_templ) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	memcpy(metadata_templ, metadata, (i + 1) * sizeof(glite_jp_attrval_t));
-	
-	q_min_time_tr = regtime_trunc(q_min_time);
-	q_max_time_tr = regtime_ceil(q_max_time);
-
-	if (q_exact_owner) {
-		ownerhash = str2md5(q_exact_owner); /* static buffer */
-		if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path, ownerhash) == -1) {
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		owner_dirp = opendir(owner_dirname);
-		free(owner_dirname);
-		if (!owner_dirp) {
-			free(metadata_templ);
-			return 0; /* found nothing */
-		}
-		while ((ttimeent = readdir(owner_dirp)) != NULL) {
-			if (!strcmp(ttimeent->d_name, ".")) continue;
-			if (!strcmp(ttimeent->d_name, "..")) continue;
-			ttime = atol(ttimeent->d_name);
-			if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-				if (query_phase2(ctx, ownerhash, ttime, q_with_tags, md_tags,
-						query, metadata_templ, callback)) {
-					err.code = EIO;
-					err.desc = "query_phase2() error";
-					goto error_out;
-				}
-			}
-		}
-	} else { /* !q_exact_owner */
-		if (asprintf(&data_dirname, "%s/data", config->internal_path) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		data_dirp = opendir(data_dirname);
-		if (!data_dirp) {
-			err.code = EIO;
-			err.desc = "Cannot open data directory";
-			goto error_out;
-		}
-		while ((ownerent = readdir(data_dirp)) != NULL) {
-			if (!strcmp(ownerent->d_name, ".")) continue;
-			if (!strcmp(ownerent->d_name, "..")) continue;
-			if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path,
-					ownerent->d_name) == -1) {
-				err.code = ENOMEM;
-				goto error_out;
-			}
-			owner_dirp = opendir(owner_dirname);
-			free(owner_dirname);
-			if (!owner_dirp) {
-				err.code = EIO;
-				err.desc = "Cannot open owner data directory";
-				goto error_out;
-			}
-			while ((ttimeent = readdir(owner_dirp)) != NULL) {
-				if (!strcmp(ttimeent->d_name, ".")) continue;
-				if (!strcmp(ttimeent->d_name, "..")) continue;
-				ttime = atol(ttimeent->d_name);
-				if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-					if (query_phase2(ctx, ownerent->d_name, ttime, q_with_tags, md_tags,
-							query, metadata_templ, callback)) {
-						err.code = EIO;
-						err.desc = "query_phase2() error";
-						goto error_out;
-					}
-				}
-			}
-			closedir(owner_dirp); owner_dirp = NULL;
-		}
-		closedir(data_dirp); data_dirp = NULL;
-	}
-	return 0;
-
-error_out:
-	if (owner_dirp) closedir(owner_dirp);
-	if (data_dirp) closedir(data_dirp);
-	free(data_dirname);
-	free(metadata_templ);
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#else 
-
-/* placeholder instead */
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	glite_jp_error_t	err;
-	err.code = ENOSYS;
-	err.desc = "not implemented";
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#endif
-
-/* XXX:
-- no primary authorization yet
-- no concurrency control yet
-- partial success in pwrite,append
-- "unique" part of jobid is assumed to be unique across bookkeeping servers
-- repository versioning not fully implemented yet
-*/
diff --git a/org.glite.jp.client/src/is_client.c b/org.glite.jp.client/src/is_client.c
deleted file mode 100644
index 8a747ef..0000000
--- a/org.glite.jp.client/src/is_client.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-
-#include "feed.h"
-/* FIXME
-#include "jpis_H.h"
-#include "jpis_.nsmap"
-*/
-
-int glite_jpps_single_feed(
-		glite_jp_context_t ctx,
-		const char *destination,
-		const char *job,
-		const glite_jp_attrval_t attrs[]
-)
-{
-	/* TODO: really call JP Index server (via interlogger) */
-	printf("feed to %s, job %s\n",destination,job);
-
-/* FIXME */
-#if 0
-	if (soap_call_jpsrv__UpdateJobs(ctx->other_soap,destination,"",
-		/* FIXME: feedId */ "",
-		/* FIXME: UpdateJobsData */ NULL,
-		0,
-		NULL
-	)) fprintf(stderr,"UpdateJobs: %s %s\n",ctx->other_soap->fault->faultcode,
-		ctx->other_soap->fault->faultstring);
-
-#endif
-	return 0;
-}
diff --git a/org.glite.jp.client/src/jpimporter.c b/org.glite.jp.client/src/jpimporter.c
deleted file mode 100644
index b54aac8..0000000
--- a/org.glite.jp.client/src/jpimporter.c
+++ /dev/null
@@ -1,243 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/lb/lb_maildir.h"
-#include "glite/security/glite_gsplugin.h"
-
-#include "jpps_H.h"
-#include "jpps_.nsmap"
-
-#include "jptype_map.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
-#endif
-
-
-#ifndef dprintf
-#define dprintf(x)		{ if (debug) printf x; }
-#endif
-
-#ifndef GLITE_JPIMPORTER_PIDFILE
-#define GLITE_JPIMPORTER_PIDFILE	"/var/run/glite-jpimporter.pid"
-#endif 
-
-#ifndef GLITE_JPIMPORTER_MDIR
-#define GLITE_JPIMPORTER_MDIR		"/tmp/jpreg"
-#endif 
-
-static int	debug = 0;
-static int	die = 0;
-
-static struct option opts[] = {
-	{ "help",        0, NULL,    'h'},
-	{ "debug",       0, NULL,    'd'},
-	{ "jpps",        1, NULL,    'p'},
-	{ "mdir",        1, NULL,    'm'},
-	{ "pidfile",     1, NULL,    'i'},
-	{ NULL,          0, NULL,     0}
-};
-
-static const char *get_opt_string = "hdp:m:i:";
-
-static void usage(char *me)
-{
-	fprintf(stderr,"usage: %s [option]\n"
-		"\t-h, --help\t displays this screen\n"
-		"\t-d, --debug\t don't run as daemon, additional diagnostics\n"
-		"\t-p, --jpps\t JP primary service server\n"
-		"\t-m, --mdir\t path to the 'LB maildir' subtree\n"
-		"\t-i, --pidfile\t file to store master pid\n",
-		me);
-}
-
-static void catchsig(int sig)
-{
-	die = sig;
-}
-
-int main(int argc, char *argv[])
-{
-	struct sigaction	sa;
-	struct soap		   *soap;
-	sigset_t			sset;
-	FILE			   *fpid;
-	int					opt;
-	char			   *name,
-					   *jpps = "http://localhost:8901",
-						pidfile[PATH_MAX] = GLITE_JPIMPORTER_PIDFILE,
-						mdir[PATH_MAX] = GLITE_JPIMPORTER_MDIR;
-
-
-	name = strrchr(argv[0],'/');
-	if (name) name++; else name = argv[0];
-
-	if ( geteuid() )
-		snprintf(pidfile, sizeof pidfile, "%s/glite_jpimporter.pid", getenv("HOME"));
-
-	while ( (opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF )
-	switch ( opt ) {
-		case 'd': debug = 1; break;
-		case 'h': usage(name); return 0;
-		case 'p': jpps = optarg; break;
-		case 'm': strcpy(mdir, optarg); break;
-		case 'i': strcpy(pidfile, optarg); break;
-		case '?': usage(name); return 1;
-	}
-	if ( optind < argc ) { usage(name); return 1; }
-
-	soap = soap_new();
-	soap_init(soap);
-	soap_set_namespaces(soap, jpps__namespaces);
-	soap_register_plugin(soap, glite_gsplugin);
-
-	setlinebuf(stdout);
-	setlinebuf(stderr);
-
-	fpid = fopen(pidfile,"r");
-	if ( fpid ) {
-		int opid = -1;
-
-		if ( fscanf(fpid,"%d",&opid) == 1 ) {
-			if ( !kill(opid,0) ) {
-				fprintf(stderr,"%s: another instance running, pid = %d\n",argv[0],opid);
-				return 1;
-			}
-			else if (errno != ESRCH) { perror("kill()"); return 1; }
-		}
-		fclose(fpid);
-	} else if (errno != ENOENT) { perror(pidfile); return 1; }
-	fpid = fopen(pidfile, "w");
-	if ( !fpid ) { perror(pidfile); return 1; }
-	fprintf(fpid, "%d", getpid());
-	fclose(fpid);
-		
-	if ( !debug ) {
-		if ( daemon(1,0) == -1 ) { perror("deamon()"); exit(1); }
-
-		fpid = fopen(pidfile,"w");
-		if ( !fpid ) { perror(pidfile); return 1; }
-		fprintf(fpid, "%d", getpid());
-		fclose(fpid);
-		openlog(name, LOG_PID, LOG_DAEMON);
-	} else { setpgid(0, getpid()); }
-
-	dprintf(("Master pid %d\n", getpid()));
-
-	memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL);
-	sa.sa_handler = catchsig;
-	sigaction(SIGINT, &sa, NULL);
-	sigaction(SIGTERM, &sa, NULL);
-
-	sa.sa_handler = SIG_IGN;
-	sigaction(SIGUSR1, &sa, NULL);
-
-	sigemptyset(&sset);
-	sigaddset(&sset, SIGTERM);
-	sigaddset(&sset, SIGINT);
-	sigprocmask(SIG_BLOCK, &sset, NULL);
-
-	while ( !die ) {
-		int		ret;
-		char   *msg = NULL;
-		char   *fname = NULL;
-
-		ret = edg_wll_MaildirTransStart(mdir, &msg, &fname);
-		/* XXX: where should unblocking signal besides? */
-		sigprocmask(SIG_UNBLOCK, &sset, NULL);
-		sigprocmask(SIG_BLOCK, &sset, NULL);
-		if ( ret < 0 ) {
-			dprintf(("edg_wll_MaildirTransStart: %s (%s)\n", strerror(errno), lbm_errdesc));
-			if ( !debug ) syslog(LOG_ERR, "edg_wll_MaildirTransStart: %s (%s)", strerror(errno), lbm_errdesc);
-			exit(1);
-		} else if ( ret == 0 ) {
-			sleep(2);
-		} else {
-			struct _jpelem__RegisterJob			in;
-			struct _jpelem__RegisterJobResponse	empty;
-			struct SOAP_ENV__Detail				*detail;
-			struct jptype__genericFault			*f;
-			char	*aux, *reason, indent[200] = "  ";
-
-
-			dprintf(("JP registration request received\n"));
-			if ( !debug ) syslog(LOG_INFO, "JP registration request received\n");
-
-			if ( !(aux = strchr(msg, '\n')) ) {
-				dprintf(("Wrong format of message!\n"));
-				if ( !debug ) syslog(LOG_ERR, "Wrong format of message\n");
-				free(msg);
-				continue;
-			}
-			*aux++ = '\0';
-			in.job = msg;
-			in.owner = aux;
-			ret = soap_call___jpsrv__RegisterJob(soap, jpps, "", &in, &empty);
-			free(msg);
-
-			switch ( ret ) {
-			case SOAP_OK:
-				/* XXX: checks return error code */
-				edg_wll_MaildirTransEnd(mdir, fname, LBMD_TRANS_OK);
-				dprintf(("Job '%s' succesfully registered to JP\n", msg));
-				if ( !debug ) syslog(LOG_INFO, "Job '%s' succesfully registered to JP\n", msg);
-				break;
-
-			case SOAP_FAULT:
-			case SOAP_SVR_FAULT:
-				edg_wll_MaildirTransEnd(mdir, fname, LBMD_TRANS_FAILED);
-				if (soap->version == 2) {
-					detail = soap->fault->SOAP_ENV__Detail;
-					reason = soap->fault->SOAP_ENV__Reason;
-				} else {
-					detail = soap->fault->detail;
-					reason = soap->fault->faultstring;
-				}
-				dprintf(("%s\n", reason));
-				assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
-				f = ((struct _genericFault *) detail->fault)
-#else
-				f = ((struct _genericFault *) detail->value)
-#endif
-					-> jpelem__genericFault;
-
-				while ( f ) {
-					dprintf(("%s%s: %s (%s)\n", indent, f->source, f->text, f->description));
-					f = f->reason;
-					strcat(indent, "  ");
-				}
-				break;
-
-			default:
-				soap_print_fault(soap, stderr);
-				edg_wll_MaildirTransEnd(mdir, fname, LBMD_TRANS_FAILED);
-				break;
-			}
-			free(fname);
-		}
-	}
-
-	/* XXX: some sort of soap_destroy(soap) */
-	dprintf(("Terminating on signal %d\n", die));
-	if ( !debug ) syslog(LOG_INFO, "Terminating on signal %d\n", die);
-
-	unlink(pidfile);
-
-	return 0;
-}
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
-
diff --git a/org.glite.jp.client/src/jptype_map.h b/org.glite.jp.client/src/jptype_map.h
deleted file mode 100644
index 56d611f..0000000
--- a/org.glite.jp.client/src/jptype_map.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "soap_version.h"
-
-#if GSOAP_VERSION >= 20700
-#define INPUT_SANDBOX	jptype__UploadClass__INPUT_SANDBOX
-#define OUTPUT_SANDBOX	jptype__UploadClass__OUTPUT_SANDBOX
-#define JOB_LOG	jptype__UploadClass__JOB_LOG
-
-#define OWNER jptype__AttributeType__OWNER
-#define TIME jptype__AttributeType__TIME
-#define TAG jptype__AttributeType__TAG
-
-#define EQUAL jptype__queryOp__EQUAL
-#define UNEQUAL jptype__queryOp__UNEQUAL
-#define LESS jptype__queryOp__LESS
-#define GREATER jptype__queryOp__GREATER
-#define WITHIN jptype__queryOp__WITHIN
-#endif
-
diff --git a/org.glite.jp.client/src/mysql.c b/org.glite.jp.client/src/mysql.c
deleted file mode 100644
index 0f080ce..0000000
--- a/org.glite.jp.client/src/mysql.c
+++ /dev/null
@@ -1,265 +0,0 @@
-#ident "$Header$"
-
-#include "mysql.h"	// MySql header file
-#include "mysqld_error.h"
-#include "errmsg.h"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "db.h"
-
-#define DEFAULTCS	"jpps/@localhost:jpps1"
-#define GLITE_JP_LB_MYSQL_VERSION 40018
-
-static int  my_err(glite_jp_context_t ctx, char *function)
-{	
-	glite_jp_error_t err; 
-
-  	glite_jp_clear_error(ctx); 
-	memset(&err,0,sizeof err); 
-	err.source = function;
-	err.code = EIO; /* XXX */
-	err.desc = mysql_error((MYSQL *) ctx->dbhandle); 
-	return glite_jp_stack_error(ctx,&err); 
-}
-
-struct _glite_jp_db_stmt_t {
-	MYSQL_RES		*result;
-	glite_jp_context_t	ctx;
-};
-
-int glite_jp_db_connect(glite_jp_context_t ctx,char *cs)
-{
-	char	*buf = NULL;
-	char	*host,*user,*pw,*db; 
-	char	*slash,*at,*colon;
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (!cs) cs = DEFAULTCS;
-
-	if (!(ctx->dbhandle = (void *) mysql_init(NULL))) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	mysql_options(ctx->dbhandle, MYSQL_READ_DEFAULT_FILE, "my");
-
-	host = user = pw = db = NULL;
-
-	buf = strdup(cs);
-	slash = strchr(buf,'/');
-	at = strrchr(buf,'@');
-	colon = strrchr(buf,':');
-
-	if (!slash || !at || !colon) {
-		free(buf);
-		err.code = EINVAL;
-		err.desc = "Invalid DB connect string";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	*slash = *at = *colon = 0;
-	host = at+1;
-	user = buf;
-	pw = slash+1;
-	db = colon+1;
-
-	if (!mysql_real_connect((MYSQL *) ctx->dbhandle,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) {
-		free(buf);
-		return my_err(ctx, __FUNCTION__);
-	}
-
-	free(buf);
-	return 0;
-}
-
-void glite_jp_db_close(glite_jp_context_t ctx)
-{
-	mysql_close((MYSQL *) ctx->dbhandle);
-	ctx->dbhandle = NULL;
-}
-
-int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *stmt)
-{
-	int	merr;
-	int	retry_nr = 0;
-	int	do_reconnect = 0;
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (stmt) {
-		*stmt = NULL;
-	}
-
-	while (retry_nr == 0 || do_reconnect) {
-		do_reconnect = 0;
-		if (mysql_query((MYSQL *) ctx->dbhandle,txt)) {
-			/* error occured */
-			switch (merr = mysql_errno((MYSQL *) ctx->dbhandle)) {
-				case 0:
-					break;
-				case ER_DUP_ENTRY: 
-					err.code = EEXIST;
-					err.desc = mysql_error((MYSQL *) ctx->dbhandle);
-					glite_jp_stack_error(ctx,&err);
-					return -1;
-					break;
-				case CR_SERVER_LOST:
-					if (retry_nr <= 0) 
-						do_reconnect = 1;
-					break;
-				default:
-					my_err(ctx, __FUNCTION__);
-					return -1;
-					break;
-			}
-		}
-		retry_nr++;
-	}
-
-	if (stmt) {
-		*stmt = malloc(sizeof(**stmt));
-		if (!*stmt) {
-			err.code = ENOMEM;
-			glite_jp_stack_error(ctx,&err);
-			return -1;
-		}
-		memset(*stmt,0,sizeof(**stmt));
-		(**stmt).ctx = ctx;
-		(**stmt).result = mysql_store_result((MYSQL *) ctx->dbhandle);
-		if (!(**stmt).result) {
-			if (mysql_errno((MYSQL *) ctx->dbhandle)) {
-				my_err(ctx, __FUNCTION__);
-				return -1;
-			}
-		}
-	} else {
-		MYSQL_RES	*r = mysql_store_result((MYSQL *) ctx->dbhandle);
-		mysql_free_result(r);
-	}
-	
-	return mysql_affected_rows((MYSQL *) ctx->dbhandle);
-}
-
-int glite_jp_db_fetchrow(glite_jp_db_stmt_t stmt,char **res)
-{
-	MYSQL_ROW	row;
-	glite_jp_context_t	ctx = stmt->ctx;
-	int 		nr,i;
-	unsigned long	*len;
-
-	glite_jp_clear_error(ctx);
-
-	if (!stmt->result) return 0;
-
-	if (!(row = mysql_fetch_row(stmt->result))) {
-		if (mysql_errno((MYSQL *) ctx->dbhandle)) {
-			my_err(ctx, __FUNCTION__);
-			return -1;
-		} else return 0;
-	}
-
-	nr = mysql_num_fields(stmt->result);
-	len = mysql_fetch_lengths(stmt->result);
-	for (i=0; iresult))) cols[i++] = f->name;
-	return i == 0;
-}
-
-void glite_jp_db_freestmt(glite_jp_db_stmt_t *stmt)
-{
-	if (*stmt) {
-		if ((**stmt).result) mysql_free_result((**stmt).result);
-		free(*stmt);
-		*stmt = NULL;
-	}
-}
-
-
-char *glite_jp_db_timetodb(time_t t)
-{
-	struct tm	*tm = gmtime(&t);
-	char	tbuf[256];
-
-	/* XXX: the very end of our days */
-	if (!tm && t == (time_t) LONG_MAX) return strdup("9999-12-31 23:59:59");
-
-	sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'",tm->tm_year+1900,tm->tm_mon+1,
-		tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
-	
-	return strdup(tbuf);
-}
-
-time_t glite_jp_db_dbtotime(char *t)
-{
-	struct tm	tm;
-
-	memset(&tm,0,sizeof(tm));
-	setenv("TZ","UTC",1); tzset();
-	sscanf(t,"%4d-%02d-%02d %02d:%02d:%02d",
-		&tm.tm_year,&tm.tm_mon,&tm.tm_mday,
-		&tm.tm_hour,&tm.tm_min,&tm.tm_sec);
-	tm.tm_year -= 1900;
-	tm.tm_mon--;
-
-	return mktime(&tm);
-}
-
-int glite_jp_db_dbcheckversion(glite_jp_context_t ctx)
-{
-	MYSQL	*m = (MYSQL *) ctx->dbhandle;
-	const   char *ver_s = mysql_get_server_info(m);
-	int	major,minor,sub,version;
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (!ver_s || 3 != sscanf(ver_s,"%d.%d.%d",&major,&minor,&sub)) {
-		err.code = EINVAL;
-		err.desc = "problem checking MySQL version";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	version = 10000*major + 100*minor + sub;
-
-	if (version < GLITE_JP_LB_MYSQL_VERSION) {
-		char	msg[300];
-
-		snprintf(msg,sizeof msg,"Your MySQL version is %d. At least %d required.",version, GLITE_JP_LB_MYSQL_VERSION);
-		err.code = EINVAL;
-		err.desc = msg;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
diff --git a/org.glite.jp.client/src/new_ftp_backend.c b/org.glite.jp.client/src/new_ftp_backend.c
deleted file mode 100644
index 930030e..0000000
--- a/org.glite.jp.client/src/new_ftp_backend.c
+++ /dev/null
@@ -1,1790 +0,0 @@
-#ident "$Header$"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-
-#include "tags.h"
-#include "backend.h"
-#include "db.h"
-
-#include "jpps_H.h"	/* XXX: SOAP_TYPE___jpsrv__GetJob */
-
-#define FTPBE_DEFAULT_DB_CS	"jpps/@localhost:jpps"
-
-struct ftpbe_config {
-	char *internal_path;
-	char *external_path;
-	char *db_cs;
-	char *gridmap;
-	char *logname;
-};
-
-static struct ftpbe_config *config = NULL;
-
-struct fhandle_rec {
-	int fd;
-	int fd_append;
-};
-typedef struct fhandle_rec *fhandle;
-
-static struct option ftpbe_opts[] = {
-	{ "ftp-internal-path", 1, NULL, 'I' },
-	{ "ftp-external-path", 1, NULL,	'E' },
-	{ "ftp-db-cs",	       1, NULL,	'D' },
-	{ "ftp-gridmap",       1, NULL,	'G' },
-	{ NULL,                0, NULL,  0  }
-};
-
-/*******************************************************************************
-	Internal helpers
-*******************************************************************************/
-
-
-static int config_check(
-	glite_jp_context_t ctx,
-	struct ftpbe_config *config)
-{
-	return config == NULL ||
-		config->internal_path == NULL ||
-		config->external_path == NULL ||
-		config->db_cs == NULL ||
-		config->gridmap == NULL ||
-		config->logname == NULL;
-
-	/* XXX check reality */
-}
-
-static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job, 
-			  char **unique, char **ju_path, int get_path)
-{
-	char *p;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	p = strrchr(job, '/');
-	if (!p) {
-		err.code = EINVAL;
-		err.desc = "Malformed jobid";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	/* XXX thorough checks */
-	if (!(*unique = strdup(p+1))) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (get_path) {
-		if (!(*ju_path = strdup(p+1))) {
-			free(*unique);
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		*(*ju_path + 10) = '\0';
-	}
-	return 0;
-}
-
-static int mkdirpath(const char* path, int prefixlen)
-{
-	char *wpath, *p;
-	int goout, ret;
-
-	wpath = strdup(path);
-	if (!wpath) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	p = wpath + prefixlen;
-	goout = 0;
-	while (!goout) {
-		while (*p == '/') p++;
-		while (*p != '/' && *p != '\0') p++;
-		goout = (*p == '\0');
-		*p = '\0';
-		ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR);
-		if (ret < 0 && errno != EEXIST) break;
-		*p = '/';
-	}
-	free(wpath);
-	return goout ? 0 : ret;
-}
-
-static int store_user(glite_jp_context_t ctx, const char *userid, const char *subj)
-{
-	glite_jp_error_t err;
-	char *stmt;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	assert(userid != NULL);
-	assert(subj != NULL);
-
-	trio_asprintf(&stmt,"insert into users(userid,cert_subj) "
-		"values ('%|Ss','%|Ss')",userid,subj);
-	if (!stmt) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		if (ctx->error->code == EEXIST) 
-			glite_jp_clear_error(ctx);
-		else {
-			free(stmt);
-			err.code = EIO;
-			err.desc = "DB access failed";
-			return glite_jp_stack_error(ctx,&err);
-		}
-	}
-	free(stmt);
-
-	return 0;
-}
-
-static long regtime_trunc(long tv_sec)
-{
-	return tv_sec / (86400*7);
-}
-
-static long regtime_ceil(long tv_sec)
-{
-	return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ;
-}
-
-/********************************************************************************
-	Backend calls
-********************************************************************************/
-int glite_jppsbe_init(
-	glite_jp_context_t ctx,
-	int argc,
-	char *argv[]
-)
-{
-	glite_jp_error_t err;
-	int opt;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	config = (struct ftpbe_config *) calloc(1, sizeof *config);
-	if (!config) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	config->logname = getlogin();
-
-	while ((opt = getopt_long(argc, argv, "I:E:G:", ftpbe_opts, NULL)) != EOF) {
-		switch (opt) {
-			case 'I': config->internal_path = optarg; break;
-			case 'E': config->external_path = optarg; break;
-			case 'D': config->db_cs = optarg; break;
-			case 'G': config->gridmap = optarg; break;
-			default: break;
-		}
-	}
-
-	/* Defaults */
-	if (!config->db_cs) config->db_cs = strdup(FTPBE_DEFAULT_DB_CS);
-
-	if (config_check(ctx, config)) {
-		err.code = EINVAL;
-		err.desc = "Invalid FTP backend configuration";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jp_db_connect(ctx, config->db_cs)) {
-		err.code = EIO;
-		err.desc = "Cannot access backend's database (during init)";
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		glite_jp_db_close(ctx); /* slaves open their own connections */
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_init_slave(
-	glite_jp_context_t ctx
-)
-{
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	if (glite_jp_db_connect(ctx, config->db_cs)) {
-		err.code = EIO;
-		err.desc = "Cannot access backend's database";
-		return glite_jp_stack_error(ctx,&err);
-	} 
-
-	return 0;
-}
-
-int glite_jppsbe_register_job(	
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *owner
-)
-{
-	glite_jp_error_t err;
-	char *data_dir = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *ownerhash = NULL;
-	struct timeval reg_tv;
-	char *stmt = NULL;
-	char *dbtime = NULL;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job != NULL);
-	assert(owner != NULL);
-
-	gettimeofday(®_tv, NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	ownerhash = str2md5(owner); /* static buffer */
-	if (store_user(ctx, ownerhash, owner)) {
-		err.code = EIO;
-		err.desc = "Cannot store user entry";
-		goto error_out;
-	}
-
-	dbtime = glite_jp_db_timetodb(reg_tv.tv_sec);
-	if (!dbtime) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	trio_asprintf(&stmt,"insert into jobs(jobid,dg_jobid,owner,reg_time) "
-		"values ('%|Ss','%|Ss','%|Ss', %s)",
-		ju, job, ownerhash, dbtime);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		if (ctx->error->code == EEXIST) {
-			err.code = EEXIST;
-			err.desc = "Job already registered";
-		}
-		else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	if (asprintf(&data_dir, "%s/data/%s/%d/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 &&
-			errno != EEXIST) {
-		err.code = errno;
-		err.desc = "Cannot mkdir jobs's data directory";
-		goto error_out;
-	}
-
-error_out:
-	free(data_dir);
-	free(stmt); free(dbtime);
-	free(ju); free(ju_path);
-
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int add_to_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	gridmap = fopen(config->gridmap, "a");
-	if (!gridmap) {
-		err.code = errno;
-		err.desc = "Cannot open gridmap file";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 ||
-		ferror(gridmap)) {
-		err.code = EIO;
-		err.desc = "Cannot write to gridmap file";
-		fclose(gridmap);
-		return glite_jp_stack_error(ctx,&err);
-	}
-	fclose(gridmap);
-	return 0;
-}
-
-static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	char *temp_name = NULL;
-	FILE *temp_file = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	/* XXX */
-	return 0;
-}
-
-int glite_jppsbe_start_upload(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	
-	const char *content_type,
-	char **destination_out,
-	time_t *commit_before_inout
-)
-{
-	char *data_basename = NULL;
-	char *data_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *peername = NULL;
-	char *peerhash = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[2] = { NULL, NULL };
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(destination_out!=NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	peername = glite_jp_peer_name(ctx);
-	if (peername == NULL) {
-		err.code = EINVAL;
-		err.desc = "Cannot obtain client certificate info";
-		goto error_out;
-	}
-
-	trio_asprintf(&stmt, "select owner, reg_time from jobs"
-		" where jobid='%|Ss'", ju);
-
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such job registered";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-	
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 2) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-
-	glite_jp_db_freestmt(&db_res);
-	
-	/* XXX authorization done in soap_ops.c */
-
-	/* XXX name length */
-	if (asprintf(&data_basename, "%s%s%s", class,
-		(name != NULL) ? "." : "",
-		(name != NULL) ? name : "") == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(&data_fname, "%s/data/%s/%d/%s/%s",
-			config->internal_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (asprintf(destination_out, "%s/data/%s/%d/%s/%s",
-			config->external_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (commit_before_inout != NULL)
-	/* XXX no timeout enforced */
-		/* XXX: gsoap does not like so much, one year should be enough
-		*commit_before_inout = (time_t) LONG_MAX;
-		*/
-		*commit_before_inout = time(NULL) + 365*24*60*60;
-	
-	/* 
-	if (add_to_gridmap(ctx, peername)) {
-		err.code = EIO;
-		err.desc = "Cannot add peer DN to ftp server authorization file";
-		goto error_out;
-	}
-	*/
-
-	peerhash = str2md5(peername); /* static buffer */
-	if (store_user(ctx, peerhash, peername)) {
-		err.code = EIO;
-		err.desc = "Cannot store upload user entry";
-		goto error_out;
-	}
-
-	free(stmt); stmt = NULL;
-	trio_asprintf(&stmt,"insert into files"
-		"(jobid,filename,int_path,ext_url,state,deadline,ul_userid) "
-		"values ('%|Ss','%|Ss','%|Ss','%|Ss','%|Ss', '%|Ss', '%|Ss')",
-		ju, data_basename, data_fname, *destination_out, "uploading", 
-		glite_jp_db_timetodb(*commit_before_inout), peerhash);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		if (ctx->error->code == EEXIST) {
-			err.code = EEXIST;
-			err.desc = "File already stored or upload in progress";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-	
-error_out:
-	free(db_row[0]); free(db_row[1]);
-	free(stmt);
-	free(data_basename); 
-	free(data_fname); 
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_commit_upload(
-	glite_jp_context_t ctx,
-	const char *destination
-)
-{
-	char *peername = NULL;
-	char *peerhash = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-	int i;
-	
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(destination != NULL);
-
-	trio_asprintf(&stmt, "select * from files where "
-			     "ext_url='%|Ss' and state='uploading'", destination);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such upload in progress";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 7) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-	glite_jp_db_freestmt(&db_res);
-
-	peername = glite_jp_peer_name(ctx);
-	if (peername == NULL) {
-		err.code = EINVAL;
-		err.desc = "Cannot obtain client certificate info";
-		goto error_out;
-	}
-
-	peerhash = str2md5(peername); /* static buffer */
-	if (strcmp(peerhash, db_row[6])) {
-		err.code = EPERM;
-		err.desc = "Upload started by client with different identity";
-		goto error_out;
-	}
-
-	free(stmt);
-	trio_asprintf(&stmt,"update files set state='committed', deadline=NULL "
-		"where jobid='%|Ss' and filename='%|Ss'", db_row[0], db_row[1]);
-	
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-error_out:
-	for (i=0; i<7; i++) free(db_row[i]);
-	free(peername);
-	free(stmt);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_destination_info(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char **job,
-	char **class,
-	char **name
-)
-{
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[2] = { NULL, NULL};
-	int i;
-	char *cp = NULL;
-	
-	char *classname = NULL;
-	glite_jp_error_t err;
-
-	assert(destination != NULL);
-	assert(job != NULL);
-	assert(class != NULL);
-	assert(name != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	
-	trio_asprintf(&stmt, "select j.dg_jobid,f.filename from jobs j,files f where "
-			     "f.ext_url='%|Ss' and j.jobid=f.jobid", destination);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "Invalid destination string";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 2) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-	glite_jp_db_freestmt(&db_res);
-
-	*job = strdup(db_row[0]);
-
-	cp = strchr(db_row[1],'.');
-	if (!cp) { 
-		*name = NULL;
-	} else {
-		*cp++ = '\0';
-		*name = strdup(cp);
-	}
-	*class = strdup(db_row[1]);
-
-	if (!*job || !*class)  {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	for (i=0; i<2; i++) free(db_row[i]);
-	free(stmt);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-
-int glite_jppsbe_get_job_url(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	
-	char **url_out
-)
-{
-	char *data_basename = NULL;
-	char *data_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[3] = { NULL, NULL, NULL };
-
-	long reg_time;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(url_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/ : ""name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	trio_asprintf(&stmt, "select j.owner,reg_time,u.cert_subj from jobs j, users u "
-		"where j.jobid='%|Ss' and j.owner = u.userid", ju);
-
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such job registered";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	free(stmt); stmt = NULL;
-	
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 3) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-
-	glite_jp_db_freestmt(&db_res);
-
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJob,job,db_row[2])) {
-		err.code = EPERM;
-		goto error_out;
-	}
-	
-	/* XXX name length */
-	if (asprintf(&data_basename, "%s%s%s", class,
-		(name != NULL) ? "." : "",
-		(name != NULL) ? name : "") == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(url_out, "%s/data/%s/%d/%s/%s",
-			config->external_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	trio_asprintf(&stmt,"select 'x' from files where jobid='%|Ss' "
-				"and ext_url = '%|Ss' "
-				"and state='committed' ",ju,*url_out);
-
-	if ((db_retn = glite_jp_db_execstmt(ctx,stmt,&db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "not uploaded yet";
-		}
-		else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		/* goto error_out; */
-	}
-
-error_out:
-	free(db_row[0]); free(db_row[1]);
-	free(stmt);
-	free(data_basename);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int get_job_fname(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	
-	char **fname_out
-)
-{
-	char *data_basename = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[2] = { NULL, NULL };
-
-	long reg_time;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(fname_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	trio_asprintf(&stmt, "select owner, reg_time from jobs "
-		"where jobid='%|Ss'", ju);
-
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such job registered";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-	
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 2) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-
-	glite_jp_db_freestmt(&db_res);
-	
-	/* XXX name length */
-	if (asprintf(&data_basename, "%s%s%s", class,
-		(name != NULL) ? "." : "", (name != NULL) ? name : "") == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(fname_out, "%s/data/%s/%d/%s/%s",
-			config->internal_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	free(db_row[0]); free(db_row[1]);
-	free(stmt);
-	free(data_basename);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-
-int glite_jppsbe_open_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,
-	int mode,
-	void **handle_out
-)
-{
-	fhandle	handle = NULL;
-	char* fname = NULL;
-	glite_jp_error_t err;
-
-	assert(handle_out != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (get_job_fname(ctx, job, class, name, &fname)) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot construct internal filename";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	handle = (fhandle) calloc(1,sizeof(*handle));
-	if (handle == NULL) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	handle->fd = open(fname, mode, S_IRUSR | S_IWUSR);
-	if (handle->fd < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file";
-		free(handle);
-		goto error_out;
-	}
-	handle->fd_append = open(fname, mode | O_APPEND, S_IRUSR | S_IWUSR);
-	if (handle->fd_append < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file for append";
-		close(handle->fd);
-		free(handle);
-		goto error_out;
-	}
-	*handle_out = (void*) handle;
-
-error_out:
-	free(fname);
-	if (err.code) { 
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_close_file(
-	glite_jp_context_t ctx,
-	void *handle
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (close(((fhandle)handle)->fd_append) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor (fd_append)";
-		goto error_out;
-	}
-	if (close(((fhandle)handle)->fd) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor";
-		goto error_out;
-	}
-
-error_out:
-	free(handle);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_pread(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset,
-	ssize_t *nbytes_ret
-)
-{
-	ssize_t ret;
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if ((ret = pread(((fhandle)handle)->fd, buf, nbytes, offset)) < 0) {
-		err.code = errno;
-		err.desc = "Error in pread()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	*nbytes_ret = ret;
-
-	return 0;
-}
-
-int glite_jppsbe_pwrite(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (pwrite(((fhandle)handle)->fd, buf, nbytes, offset) < 0) {
-		err.code = errno;
-		err.desc = "Error in pwrite()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (write(((fhandle)handle)->fd_append, buf, nbytes) < 0) {
-		err.code = errno;
-		err.desc = "Error in write()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-static int get_job_info(
-	glite_jp_context_t ctx,
-	const char *job,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	char *ju = NULL;
-	char *ju_path = NULL;
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char *int_fname = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %*s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, &ownerlen) < 4 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	free(int_fname);
-	free(ju);
-	free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-static int get_job_info_int(
-	glite_jp_context_t ctx,
-	const char *int_fname,
-	char **jobid,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char jobid_buf[256];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, jobid_buf, &ownerlen) < 5 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	*jobid = strdup(jobid_buf);
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_get_job_metadata(
-	glite_jp_context_t ctx,
-	const char *job,
-	glite_jp_attrval_t attrs_inout[]
-)
-{
-	int got_info = 0;
-	struct timeval tv_reg;
-	char *owner = NULL;
-	int got_tags = 0;
-	void *tags_handle = NULL;
-	glite_jp_tagval_t* tags = NULL;
-	int i,j;
-	glite_jp_error_t err;
-
-	assert(job != NULL);
-	assert(attrs_inout != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; attrs_inout[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (attrs_inout[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TIME:
-*/
-			if (!got_info) {
-				if (get_job_info(ctx, job, &owner, &tv_reg)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot retrieve job info";
-					goto error_out;
-				}
-				got_info = 1;
-			}
-			break;
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			if (!got_tags) {
-				if (glite_jppsbe_open_file(ctx, job, GLITE_JP_FILECLASS_TAGS,
-					O_RDONLY, &tags_handle)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot open tag file";
-					goto error_out;
-				}
-				if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot read tags";
-					glite_jppsbe_close_file(ctx, tags_handle);
-					goto error_out;
-				}
-				glite_jppsbe_close_file(ctx, tags_handle);
-				got_tags = 1;
-			}
-			break;
-*/
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type";
-			goto error_out;
-			break;
-		}
-
-		switch (attrs_inout[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-			attrs_inout[i].value.s = strdup(owner);
-			if (!attrs_inout[i].value.s) {
-				err.code = ENOMEM;
-				err.desc = "Cannot copy owner string";
-				goto error_out;
-			}	
-			break;
-		case GLITE_JP_ATTR_TIME:
-			attrs_inout[i].value.time = tv_reg;
-			break;
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			for (j = 0; tags[j].name != NULL; j++) {
-				if (!strcmp(tags[j].name, attrs_inout[i].attr.name)) {
-					if (glite_jpps_tagval_copy(ctx, &tags[j],
-						&attrs_inout[i].value.tag)) {
-						err.code = ENOMEM;
-						err.desc = "Cannot copy tag value";
-						goto error_out;
-					}
-					break;
-				}
-			}
-			if (!tags[j].name) attrs_inout[i].value.tag.name = NULL;
-			break;
-*/
-		default:
-			break;
-		}
-	}
-
-error_out:
-	free(owner);
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	free(tags);
-	
-	if (err.code) {
-		while (i > 0) {
-			i--;
-			switch (attrs_inout[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				free(attrs_inout[i].value.s);
-				break;
-			case GLITE_JP_ATTR_TAG:
-				free(attrs_inout[i].value.tag.name);
-				free(attrs_inout[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-static int compare_timeval(struct timeval a, struct timeval b)
-{
-	if (a.tv_sec < b.tv_sec) return -1;
-	if (a.tv_sec > b.tv_sec) return 1;
-	if (a.tv_usec < b.tv_usec) return -1;
-	if (a.tv_usec > b.tv_usec) return 1;
-	return 0;
-}
-
-
-/* FIXME: disabled -- clarification wrt. filetype plugin needed */
-
-#if 0
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-);
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	char *time_dirname = NULL;
-	DIR *time_dirp = NULL;
-	struct dirent *jobent;
-	char *info_fname = NULL;
-	char *jobid = NULL;
-	char *owner = NULL;
-	struct timeval tv_reg;
-	void *tags_handle = NULL;
-	int matching;
-	int i, j;
-	glite_jp_tagval_t* tags = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (asprintf(&time_dirname, "%s/data/%s/%d", config->internal_path,
-			ownerhash, regtime_tr) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	time_dirp = opendir(time_dirname);
-	if (!time_dirp) {
-		free(time_dirname);
-		return 0; /* found nothing */
-	}
-	while ((jobent = readdir(time_dirp)) != NULL) {
-		if (!strcmp(jobent->d_name, ".")) continue;
-		if (!strcmp(jobent->d_name, "..")) continue;
-		if (asprintf(&info_fname, "%s/%s/_info", time_dirname,
-				jobent->d_name) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (get_job_info_int(ctx, info_fname, &jobid, &owner,  &tv_reg)) {
-			err.code = EIO;
-			err.desc = "Cannot retrieve job info";
-			goto error_out;
-		}
-		if (q_tags || md_tags) {
-			if (glite_jppsbe_open_file(ctx, jobid, GLITE_JP_FILECLASS_TAGS,
-				O_RDONLY, &tags_handle)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot open tag file";
-				goto error_out;
-			}
-			if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot read tags";
-				glite_jppsbe_close_file(ctx, tags_handle);
-				goto error_out;
-			}
-			glite_jppsbe_close_file(ctx, tags_handle);
-			tags_handle = NULL;
-		}
-
-		matching = 1;
-		for (i = 0; matching && query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (query[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				if (query[i].value.s == NULL || 
-					strcmp(query[i].value.s, owner)) matching = 0;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				switch (query[i].op) {
-					case GLITE_JP_QUERYOP_EQUAL:
-						matching = !compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_UNEQUAL:
-						matching = compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_LESS:
-						matching = compare_timeval(tv_reg, query[i].value.time) < 0;
-						break;
-					case GLITE_JP_QUERYOP_GREATER:
-						matching = compare_timeval(tv_reg, query[i].value.time) > 0;
-						break;
-					case GLITE_JP_QUERYOP_WITHIN:
-						matching = compare_timeval(tv_reg, query[i].value.time) >= 0
-							&& compare_timeval(tv_reg, query[i].value2.time) <= 0;
-						break;
-				}
-				break;
-			case GLITE_JP_ATTR_TAG:
-				if (!tags) {
-					matching = 0;
-					break;
-				}
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, query[i].attr.name)) {
-						switch (query[i].op) {
-						case GLITE_JP_QUERYOP_EQUAL:
-							matching = !strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_UNEQUAL:
-							matching = strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_LESS:
-							matching = strcmp(tags[j].value, query[i].value.s) < 0;
-							break;
-						case GLITE_JP_QUERYOP_GREATER:
-							matching = strcmp(tags[j].value, query[i].value.s) > 0;
-							break;
-						case GLITE_JP_QUERYOP_WITHIN:
-							matching = strcmp(tags[j].value, query[i].value.s) >= 0 \
-								&& strcmp(tags[j].value, query[i].value2.s) <= 0 ;
-							break;
-						default:
-							break;
-						}
-					}
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		if (!matching) {
-			free(info_fname); info_fname = NULL;
-			free(jobid); jobid = NULL;
-			if (tags) for (j = 0; tags[j].name != NULL; j++) {
-				free(tags[j].name);
-				free(tags[j].value);
-			}
-			free(tags); tags = NULL;
-			continue;
-		}
-
-		for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				metadata[i].value.s = owner;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				metadata[i].value.time = tv_reg;
-				break;
-			case GLITE_JP_ATTR_TAG:
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, metadata[i].attr.name)) {
-						if (glite_jpps_tagval_copy(ctx, &tags[j],
-							&metadata[i].value.tag)) {
-							err.code = ENOMEM;
-							err.desc = "Cannot copy tag value";
-							goto error_out;
-						}
-						break;
-					}
-				}
-				if (!tags[j].name) {
-					metadata[i].value.tag.name = NULL;
-					metadata[i].value.tag.value = NULL;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		(*callback)(ctx, jobid, metadata);
-		free(jobid); jobid = NULL;
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-	}
-
-error_out:
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	if (tags_handle) glite_jppsbe_close_file(ctx, tags_handle);
-	free(info_fname);
-	free(owner);
-	free(jobid);
-	closedir(time_dirp);
-	free(time_dirname);
-	if (err.code)  {
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else
-		return 0;
-}
-
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	/* XXX clone metadata */
-	int i;
-	char *q_exact_owner = NULL;
-	char *ownerhash = NULL;
-	long q_min_time = 0;
-	long q_max_time = LONG_MAX;
-	long q_min_time_tr;
-	long q_max_time_tr;
-	int q_with_tags = 0;
-	int md_info = 0;
-	int md_tags = 0;
-	char *owner_dirname = NULL;
-	DIR *owner_dirp = NULL;
-	struct dirent *ttimeent;
-	char *data_dirname = NULL;
-	DIR *data_dirp = NULL;
-	struct dirent *ownerent;
-	long ttime = 0;
-	glite_jp_attrval_t *metadata_templ = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		if (query[i].attr.type == GLITE_JP_ATTR_OWNER && query[i].op == GLITE_JP_QUERYOP_EQUAL) {
-			q_exact_owner = query[i].value.s;
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TIME) {
-			switch (query[i].op) {
-			case GLITE_JP_QUERYOP_EQUAL:
-				q_min_time = query[i].value.time.tv_sec;
-				q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_LESS:
-				if (q_max_time > query[i].value.time.tv_sec + 1)
-					q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_WITHIN:
-				if (q_max_time > query[i].value2.time.tv_sec + 1)
-					q_max_time = query[i].value2.time.tv_sec + 1;
-				/* fallthrough */
-			case GLITE_JP_QUERYOP_GREATER:
-				if (q_min_time < query[i].value.time.tv_sec)
-					q_min_time = query[i].value.time.tv_sec;
-				break;
-			default:
-				err.code = EINVAL;
-				err.desc = "Invalid query op";
-				return glite_jp_stack_error(ctx,&err);
-				break;
-			}
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TAG) 
-			q_with_tags = 1;
-
-	}
-
-	for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (metadata[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-		case GLITE_JP_ATTR_TIME:
-			md_info = 1;
-			break;
-		case GLITE_JP_ATTR_TAG:
-			md_tags = 1;
-			break;
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type in metadata parameter";
-			return glite_jp_stack_error(ctx,&err);
-			break;
-		}
-	}
-	metadata_templ = (glite_jp_attrval_t *) calloc(i + 1, sizeof(glite_jp_attrval_t));
-	if (!metadata_templ) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	memcpy(metadata_templ, metadata, (i + 1) * sizeof(glite_jp_attrval_t));
-	
-	q_min_time_tr = regtime_trunc(q_min_time);
-	q_max_time_tr = regtime_ceil(q_max_time);
-
-	if (q_exact_owner) {
-		ownerhash = str2md5(q_exact_owner); /* static buffer */
-		if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path, ownerhash) == -1) {
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		owner_dirp = opendir(owner_dirname);
-		free(owner_dirname);
-		if (!owner_dirp) {
-			free(metadata_templ);
-			return 0; /* found nothing */
-		}
-		while ((ttimeent = readdir(owner_dirp)) != NULL) {
-			if (!strcmp(ttimeent->d_name, ".")) continue;
-			if (!strcmp(ttimeent->d_name, "..")) continue;
-			ttime = atol(ttimeent->d_name);
-			if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-				if (query_phase2(ctx, ownerhash, ttime, q_with_tags, md_tags,
-						query, metadata_templ, callback)) {
-					err.code = EIO;
-					err.desc = "query_phase2() error";
-					goto error_out;
-				}
-			}
-		}
-	} else { /* !q_exact_owner */
-		if (asprintf(&data_dirname, "%s/data", config->internal_path) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		data_dirp = opendir(data_dirname);
-		if (!data_dirp) {
-			err.code = EIO;
-			err.desc = "Cannot open data directory";
-			goto error_out;
-		}
-		while ((ownerent = readdir(data_dirp)) != NULL) {
-			if (!strcmp(ownerent->d_name, ".")) continue;
-			if (!strcmp(ownerent->d_name, "..")) continue;
-			if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path,
-					ownerent->d_name) == -1) {
-				err.code = ENOMEM;
-				goto error_out;
-			}
-			owner_dirp = opendir(owner_dirname);
-			free(owner_dirname);
-			if (!owner_dirp) {
-				err.code = EIO;
-				err.desc = "Cannot open owner data directory";
-				goto error_out;
-			}
-			while ((ttimeent = readdir(owner_dirp)) != NULL) {
-				if (!strcmp(ttimeent->d_name, ".")) continue;
-				if (!strcmp(ttimeent->d_name, "..")) continue;
-				ttime = atol(ttimeent->d_name);
-				if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-					if (query_phase2(ctx, ownerent->d_name, ttime, q_with_tags, md_tags,
-							query, metadata_templ, callback)) {
-						err.code = EIO;
-						err.desc = "query_phase2() error";
-						goto error_out;
-					}
-				}
-			}
-			closedir(owner_dirp); owner_dirp = NULL;
-		}
-		closedir(data_dirp); data_dirp = NULL;
-	}
-	return 0;
-
-error_out:
-	if (owner_dirp) closedir(owner_dirp);
-	if (data_dirp) closedir(data_dirp);
-	free(data_dirname);
-	free(metadata_templ);
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#else 
-
-/* placeholder instead */
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	glite_jp_error_t	err;
-	err.code = ENOSYS;
-	err.desc = "not implemented";
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#endif
-
-/* XXX:
-- no primary authorization yet
-- no concurrency control yet
-- partial success in pwrite,append
-- "unique" part of jobid is assumed to be unique across bookkeeping servers
-- repository versioning not fully implemented yet
-*/
diff --git a/org.glite.jp.client/src/simple_server.c b/org.glite.jp.client/src/simple_server.c
deleted file mode 100644
index 3bbb743..0000000
--- a/org.glite.jp.client/src/simple_server.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpps_H.h"
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-
-int main(int argc, char *argv[]) {
-   struct soap soap;
-   int i, m, s; // master and slave sockets
-
-   glite_jp_context_t	ctx;
-
-   soap_init(&soap);
-   soap_set_namespaces(&soap, jpps__namespaces);
-
-   glite_jp_init_context(&ctx);
-
-   if (glite_jppsbe_init(ctx, &argc, argv)) {
-	   /* XXX log */
-	   fputs(glite_jp_error_chain(ctx), stderr);
-	   exit(1);
-   }
-
-   soap.user = (void *) ctx;
-
-   ctx->other_soap = soap_new();
-   soap_init(ctx->other_soap);
-   soap_set_namespaces(ctx->other_soap,jpis__namespaces);
-
-   srand48(time(NULL)); /* feed id generation */
-
-   m = soap_bind(&soap, NULL, 8901, 100);
-   if (m < 0)
-      soap_print_fault(&soap, stderr);
-   else
-   {
-      fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
-      for (i = 1; ; i++) {
-         s = soap_accept(&soap);
-         if (s < 0) {
-            soap_print_fault(&soap, stderr);
-            break;
-         }
-         jpps__serve(&soap); // process RPC request
-         soap_destroy(&soap); // clean up class instances
-         soap_end(&soap); // clean up everything and close socket
-	 glite_jp_run_deferred(ctx);
-      }
-   }
-   soap_done(&soap); // close master socket
-
-   return 0;
-}
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
diff --git a/org.glite.jp.client/src/soap_ops.c b/org.glite.jp.client/src/soap_ops.c
deleted file mode 100644
index 9411403..0000000
--- a/org.glite.jp.client/src/soap_ops.c
+++ /dev/null
@@ -1,465 +0,0 @@
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "feed.h"
-
-#include "jpps_H.h"
-/* #include "JobProvenancePS.nsmap" */
-#include "jpps_.nsmap" 
-
-#include "jptype_map.h"
-
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define __jpsrv__RegisterJob __ns1__RegisterJob
-#define __jpsrv__StartUpload __ns1__StartUpload
-#define __jpsrv__CommitUpload __ns1__CommitUpload
-#define __jpsrv__RecordTag __ns1__RecordTag
-#define __jpsrv__FeedIndex __ns1__FeedIndex
-#define __jpsrv__FeedIndexRefresh __ns1__FeedIndexRefresh
-#define __jpsrv__GetJob __ns1__GetJob
-#endif
-
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
-		const glite_jp_error_t *err)
-{
-	struct jptype__genericFault *ret = NULL;
-	if (err) {
-		ret = soap_malloc(soap,sizeof *ret);
-		memset(ret,0,sizeof *ret);
-		ret->code = err->code;
-		ret->source = soap_strdup(soap,err->source);
-		ret->text = soap_strdup(soap,strerror(err->code));
-		ret->description = soap_strdup(soap,err->desc);
-		ret->reason = jp2s_error(soap,err->reason);
-	}
-	return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
-	char	*et;
-	struct SOAP_ENV__Detail	*detail = soap_malloc(soap,sizeof *detail);
-	struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
-	f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
-	detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
-	detail->fault = f;
-#else
-	detail->value = f;
-#endif
-	detail->__any = NULL;
-
-	soap_receiver_fault(soap,"Oh, shit!",NULL);
-	if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
-	else soap->fault->detail = detail;
-}
-
-/* deprecated 
-static glite_jp_fileclass_t s2jp_fileclass(enum jptype__UploadClass class)
-{
-	switch (class) {
-		case INPUT_SANDBOX: return GLITE_JP_FILECLASS_INPUT;
-		case OUTPUT_SANDBOX: return GLITE_JP_FILECLASS_OUTPUT;
-		case JOB_LOG: return GLITE_JP_FILECLASS_LBLOG;
-		default: return GLITE_JP_FILECLASS_UNDEF;
-	}
-}
-*/
-
-static void s2jp_tag(const struct jptype__tagValue *stag,glite_jp_tagval_t *jptag)
-{
-	memset(jptag,0,sizeof *jptag);
-	jptag->name = strdup(stag->name);
-	jptag->sequence = stag->sequence ? *stag->sequence : 0;
-	jptag->timestamp = stag->timestamp ? *stag->timestamp : 0;
-	if (stag->stringValue) jptag->value = strdup(stag->stringValue);
-	else if (stag->blobValue) {
-		jptag->binary = 1;
-		jptag->size = stag->blobValue->__size;
-		jptag->value = (char *) stag->blobValue->__ptr;
-	}
-}
-
-#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t	ctx = (glite_jp_context_t) ((soap)->user)
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RegisterJob(
-		struct soap *soap,
-		struct _jpelem__RegisterJob *in,
-		struct _jpelem__RegisterJobResponse *empty)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	glite_jp_attrval_t owner_val[2];
-
-	printf("%s %s %s\n",__FUNCTION__,in->job,in->owner);
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__RegisterJob,in->job,in->owner) ||
-		glite_jppsbe_register_job(ctx,in->job,in->owner))
-	{
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	owner_val[0].attr.type = GLITE_JP_ATTR_OWNER;
-	owner_val[0].value.s = in->owner;
-	owner_val[1].attr.type = GLITE_JP_ATTR_UNDEF;
-
-/* XXX: errrors should be ingored but not silently */
-	glite_jpps_match_attr(ctx,in->job,owner_val); 
-
-	return SOAP_OK;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__StartUpload(
-		struct soap *soap,
-		struct _jpelem__StartUpload *in,
-		struct _jpelem__StartUploadResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*destination;
-	time_t	commit_before = in->commitBefore;
-	glite_jp_error_t	err;
-	glite_jpps_fplug_data_t	**pd = NULL;
-	int	i;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__StartUpload,NULL,NULL)) {
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	switch (glite_jpps_fplug_lookup(ctx,in->class_,&pd)) {
-		case ENOENT:
-			err.code = ENOENT;
-			err.source = __FUNCTION__;
-			err.desc = "unknown file class";
-			glite_jp_stack_error(ctx,&err);
-			err2fault(ctx,soap);
-			return SOAP_FAULT;
-		case 0: break;
-		default:
-			err2fault(ctx,soap);
-			return SOAP_FAULT;
-	}
-
-	for (i=0; pd[0]->uris[i] && strcmp(pd[0]->uris[i],in->class_); i++);
-	assert(pd[0]->uris[i]);
-
-	if (glite_jppsbe_start_upload(ctx,in->job,pd[0]->classes[i],in->name,in->contentType,
-				&destination,&commit_before))
-	{
-		err2fault(ctx,soap);
-		free(pd);
-		return SOAP_FAULT;
-	}
-
-	out->destination = soap_strdup(soap,destination);
-	free(destination);
-	out->commitBefore = commit_before;
-
-	free(pd);
-	return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__CommitUpload(
-		struct soap *soap,
-		struct _jpelem__CommitUpload *in,
-		struct _jpelem__CommitUploadResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*job,*class,*name;
-
-	job = class = name = NULL;
-	
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__CommitUpload,NULL,NULL) ||
-		glite_jppsbe_commit_upload(ctx,in->destination))
-	{
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	/* XXX: should not fail when commit_upload was OK */
-	assert(glite_jppsbe_destination_info(ctx,in->destination,&job,&class,&name) == 0);
-
-	/* XXX: ignore errors but don't fail silenty */
-	glite_jpps_match_file(ctx,job,class,name);
-
-	free(job); free(class); free(name);
-
-	return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag(
-		struct soap *soap,
-		struct _jpelem__RecordTag *in,
-		struct _jpelem__RecordTagResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	void	*file_be,*file_p;
-	glite_jpps_fplug_data_t	**pd = NULL;
-
-	glite_jp_tagval_t	mytag;
-
-	file_be = file_p = NULL;
-
-	/* XXX: we assume just one plugin and also that TAGS plugin handles
-	 * just one uri/class */
-
-	if (glite_jpps_fplug_lookup(ctx,GLITE_JP_FILETYPE_TAGS,&pd)
-		|| glite_jppsbe_open_file(ctx,in->jobid,pd[0]->classes[0],NULL,
-						O_RDWR|O_CREAT,&file_be)
-			/* XXX: tags need reading to check magic number */
-	) {
-		free(pd);
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	s2jp_tag(in->tag,&mytag);
-
-	/* XXX: assuming tag plugin handles just one type */
-	if (pd[0]->ops.open(pd[0]->fpctx,file_be,GLITE_JP_FILETYPE_TAGS,&file_p)
-		|| pd[0]->ops.generic(pd[0]->fpctx,file_p,GLITE_JP_FPLUG_TAGS_APPEND,&mytag))
-	{
-		err2fault(ctx,soap);
-		if (file_p) pd[0]->ops.close(pd[0]->fpctx,file_p);
-		glite_jppsbe_close_file(ctx,file_be);
-		free(pd);
-		return SOAP_FAULT;
-	}
-
-	if (pd[0]->ops.close(pd[0]->fpctx,file_p)
-		|| glite_jppsbe_close_file(ctx,file_be))
-	{
-		err2fault(ctx,soap);
-		free(pd);
-		return SOAP_FAULT;
-	}
-
-	/* XXX: ignore errors but don't fail silenty */
-	glite_jpps_match_tag(ctx,in->jobid,&mytag);
-
-	free(pd);
-	return SOAP_OK;
-}
-
-extern char *glite_jp_default_namespace;
-
-/* XXX: should be public */
-#define GLITE_JP_TAGS_NAMESPACE "http://glite.org/services/jp/tags"
-
-static void s2jp_attr(const char *in,glite_jp_attr_t *out)
-{
-	char	*buf = strdup(in),*name = strchr(buf,':'),*ns = NULL;
-
-	if (name) {
-		ns = buf; 
-		*name++ = 0;
-	}
-	else {
-		name = buf; 
-		ns = glite_jp_default_namespace;
-	}
-
-	memset(out,0,sizeof *out);
-
-	if (strcmp(ns,glite_jp_default_namespace))
-		out->type = strcmp(ns,GLITE_JP_TAGS_NAMESPACE) ?
-			GLITE_JP_ATTR_GENERIC : GLITE_JP_ATTR_TAG;
-	else {
-		if (!strcmp(name,"owner")) out->type = GLITE_JP_ATTR_OWNER;
-		else if (!strcmp(name,"time")) out->type = GLITE_JP_ATTR_OWNER;
-
-	}
-
-	if (out->type) {
-		out->name = strdup(name);
-		out->namespace = strdup(ns);
-	}
-}
-
-static void s2jp_queryval(
-		const char *in,
-		glite_jp_attrtype_t type,
-		union _glite_jp_query_rec_val *out)
-{
-	switch (type) {
-		case GLITE_JP_ATTR_OWNER:
-		case GLITE_JP_ATTR_TAG:
-		case GLITE_JP_ATTR_GENERIC:
-			out->s = strdup(in);
-			break;
-		case GLITE_JP_ATTR_TIME:
-			out->time.tv_sec = atoi(in);
-			break;
-	}
-}
-
-static void s2jp_query(const struct jptype__primaryQuery *in, glite_jp_query_rec_t *out)
-{
-	s2jp_attr(in->attr,&out->attr);
-
-	switch (in->op) {
-		case EQUAL: out->op = GLITE_JP_QUERYOP_EQUAL; break;
-		case UNEQUAL: out->op = GLITE_JP_QUERYOP_UNEQUAL; break;
-		case LESS: out->op = GLITE_JP_QUERYOP_LESS; break;
-		case GREATER: out->op = GLITE_JP_QUERYOP_GREATER; break;
-		case WITHIN:
-			out->op = GLITE_JP_QUERYOP_WITHIN;
-			s2jp_queryval(in->value2,out->attr.type,&out->value2);
-			break;
-	}
-
-	s2jp_queryval(in->value,out->attr.type,&out->value);
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex(
-		struct soap *soap,
-		struct _jpelem__FeedIndex *in,
-		struct _jpelem__FeedIndexResponse *out)
-{	
-
-/* deferred processing: return feed_id to the index server first,
- * start feeding it afterwards -- not before the index server actually
- * knows feed_id and is ready to accept the feed.
- *
- * Has to be done within the same server slave, 
- * passed through the context */
-
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*feed_id = NULL;
-	time_t	expires = 0;
-	int 	ret = SOAP_OK;
-
-	glite_jp_attr_t	*attrs = calloc(in->__sizeattributes+1,sizeof *attrs);
-	glite_jp_query_rec_t	*qry = calloc(in->__sizeconditions+1,sizeof *qry);
-	int	i;
-
-	glite_jp_clear_error(ctx);
-
-	for (i = 0; i__sizeattributes; i++) s2jp_attr(in->attributes[i],attrs+i);
-	for (i = 0; i__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);
-
-	if (in->history) {
-		if (glite_jpps_run_feed(ctx,in->destination,attrs,qry,&feed_id)) {
-			err2fault(ctx,soap);
-			ret = SOAP_FAULT;
-			goto cleanup;
-		}
-	}
-
-	if (in->continuous) {
-		if (glite_jpps_register_feed(ctx,in->destination,attrs,qry,&feed_id,&expires)) {
-			err2fault(ctx,soap);
-			ret = SOAP_FAULT;
-			goto cleanup;
-		}
-	}
-
-	if (!in->history && !in->continuous) {
-		glite_jp_error_t	err;
-		memset(&err,0,sizeof err);
-		err.code = EINVAL;
-		err.source = __FUNCTION__;
-		err.desc = "at least one of  and  must be true";
-		glite_jp_stack_error(ctx,&err);
-		err2fault(ctx,soap);
-		ret = SOAP_FAULT;
-		goto cleanup;
-	}
-
-	out->feedExpires = expires;
-	out->feedId = soap_strdup(soap,feed_id);
-
-cleanup:
-	free(feed_id);
-	for (i=0; attrs[i].type; i++) free(attrs[i].name);
-	free(attrs);
-	for (i=0; qry[i].attr.type; i++) glite_jp_free_query_rec(qry+i);
-	free(qry);
-
-	return ret;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndexRefresh(
-		struct soap *soap,
-		struct _jpelem__FeedIndexRefresh *in,
-		struct _jpelem__FeedIndexRefreshResponse *out)
-{
-	fprintf(stderr,"%s: not implemented\n",__FUNCTION__);
-	abort();
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJob(
-		struct soap *soap,
-		struct _jpelem__GetJob *in,
-		struct _jpelem__GetJobResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*url;
-
-	int	i,n;
-	glite_jp_error_t	err;
-	void	**pd;
-	struct jptype__jppsFile 	**f = NULL;
-
-	memset(&err,0,sizeof err);
-	out->__sizefiles = 0;
-
-	for (pd = ctx->plugins; *pd; pd++) {
-		glite_jpps_fplug_data_t	*plugin = *pd;
-
-		for (i=0; plugin->uris[i]; i++) {
-			glite_jp_clear_error(ctx);
-			switch (glite_jppsbe_get_job_url(ctx,in->jobid,plugin->classes[i],NULL,&url)) {
-				case 0: n = out->__sizefiles++;
-					f = realloc(f,out->__sizefiles * sizeof *f);
-					f[n] = soap_malloc(soap, sizeof **f);
-					f[n]->class_ = soap_strdup(soap,plugin->uris[i]);
-					f[n]->name = NULL;
-					f[n]->url = soap_strdup(soap,url);
-					free(url);
-					break;
-				case ENOENT:
-					break;
-				default: 
-					err.code = ctx->error->code;
-					err.source = "jpsrv__GetJob()";
-					err.desc = plugin->uris[i];
-					glite_jp_stack_error(ctx,&err);
-					err2fault(ctx,soap);
-					glite_jp_clear_error(ctx);
-					return SOAP_FAULT;
-			}
-		}
-	}
-
-	if (!out->__sizefiles) {
-		glite_jp_clear_error(ctx);
-		err.code = ENOENT;
-		err.source = __FUNCTION__;
-		err.desc = "No file found for this job";
-		glite_jp_stack_error(ctx,&err);
-		err2fault(ctx,soap);
-		glite_jp_clear_error(ctx);
-		return SOAP_FAULT;
-	}
-
-	out->files = soap_malloc(soap,out->__sizefiles * sizeof *f);
-	memcpy(out->files,f,out->__sizefiles * sizeof *f);
-
-	return SOAP_OK;
-}
-
diff --git a/org.glite.jp.client/src/tags.c b/org.glite.jp.client/src/tags.c
deleted file mode 100644
index 1f11b4d..0000000
--- a/org.glite.jp.client/src/tags.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include "tags.h"
-#include "backend.h"
-
-/* magic name_len value_len binary sequence timestamp */
-#define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#"
-#define HEADER_SIZE 48
-
-int glite_jpps_tag_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	const glite_jp_tagval_t *tag
-)
-{
-	char	hdr[HEADER_SIZE+1];
-	glite_jp_error_t	err;
-
-	unsigned long	vlen = tag->binary ? tag->size :
-				(tag->value ? strlen(tag->value) : 0);
-	int	nlen;
-
-	memset(&err,0,sizeof err);
-	err.source = "glite_jpps_tag_append()";
-
-	if (!tag->name) {
-		err.code = EINVAL;
-		err.desc = "tag name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	nlen = strlen(tag->name);
-
-	assert(sprintf(hdr,HEADER,nlen,vlen,
-			tag->binary ? "B" : "S",
-			tag->sequence, tag->timestamp) == HEADER_SIZE);
-
-	if (glite_jppsbe_append(ctx,handle,hdr,HEADER_SIZE)) {
-		err.code = EIO;
-		err.desc = "write tag header";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jppsbe_append(ctx,handle,tag->name,nlen)) {
-		err.code = EIO;
-		err.desc = "write tag name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jppsbe_append(ctx,handle,tag->value,vlen)) {
-		err.code = EIO;
-		err.desc = "write tag value";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jpps_tagval_copy(
-	glite_jp_context_t ctx,
-	glite_jp_tagval_t *from,
-	glite_jp_tagval_t *to
-)
-{
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	to->name = strdup(from->name);
-	if (!to->name) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	to->sequence = from->sequence;
-	to->timestamp = from->timestamp;
-	to->binary = from->binary;
-	to->size = from->size;
-	to->value = (char *) malloc(to->size);
-	if (!to->value) {
-		free(to->name);
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	memcpy(from->value, to->value, to->size);
-
-	return 0;
-}
-
-int glite_jpps_tag_read(
-	glite_jp_context_t ctx,
-	void *handle,
-	off_t offset,
-	glite_jp_tagval_t *tagvalue,
-	size_t *shift
-)
-{
-	char hdr[HEADER_SIZE+1];
-	unsigned int nlen;
-	unsigned long  vlen;
-	char binary;
-	unsigned sequence;
-	unsigned timestamp;
-	char * name = NULL;
-	char * value = NULL;
-	ssize_t ret;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	hdr[HEADER_SIZE] = '\0';
-	if (glite_jppsbe_pread(ctx, handle, hdr, HEADER_SIZE, offset, &ret)) {
-		err.code = EIO;
-		err.desc = "Cannot read tag header";
-		goto error_out;
-	}
-	if (ret == 0) {
-		err.code = ENOENT;
-		err.desc = "No more tags in the file";
-		goto error_out;
-	}
-	/* #define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#" */
-	if (sscanf(hdr, HEADER, &nlen, &vlen, &binary, &sequence, ×tamp) < 5) {
-		err.code = EILSEQ;
-		err.desc = "Incorrect tag header format";
-		goto error_out;
-	}
-	name = (char*) malloc(nlen + 1);
-	if (!name) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	name[nlen] = '\0';
-	value = (char*) malloc(vlen + 1);
-	if (!value) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	value[vlen] = '\0';
-	if (glite_jppsbe_pread(ctx, handle, name, nlen, offset + HEADER_SIZE, &ret)) {
-		err.code = EIO;
-		err.desc = "Cannot read tag name";
-		goto error_out;
-	}
-	if (glite_jppsbe_pread(ctx, handle, value, vlen, offset + HEADER_SIZE + nlen, &ret)) {
-		err.code = EIO;
-		err.desc = "Cannot read tag value";
-		goto error_out;
-	}
-	
-	tagvalue->name = name;
-	tagvalue->sequence = sequence;
-	tagvalue->timestamp = timestamp;
-	tagvalue->binary = (binary == 'B') ? 1 : 0;
-	tagvalue->size = vlen;
-	tagvalue->value = value;
-
-	*shift = HEADER_SIZE + nlen + vlen;
-
-	return 0;
-error_out:
-	free(name);
-	free(value);
-	return glite_jp_stack_error(ctx,&err);
-}
-
-/*
-int glite_jpps_tag_read(glite_jp_context_t, void *, off_t, glite_jp_tagval_t *, size_t);
-int glite_jpps_tag_readall(glite_jp_context_t, void *, glite_jp_tagval_t **);
-*/
-
-int glite_jpps_tag_readall(
-	glite_jp_context_t ctx,
-	void *handle,
-	glite_jp_tagval_t **tags_out
-)
-{
-	glite_jp_tagval_t * tags = NULL;
-	void * newspace;
-	int ntags = 0;
-	int ntagspace = 0;
-	off_t offset = 0;
-	int ret;
-	size_t shift;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	ntagspace = 1;
-	tags = (glite_jp_tagval_t *) calloc(ntagspace + 1, sizeof(*tags));
-	if (!tags) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	while (!(ret = glite_jpps_tag_read(ctx, handle, offset, &tags[ntags], &shift))) {
-		offset += shift;
-		ntags++;
-		if (ntagspace <= ntags) {
-			ntagspace += 1;
-			newspace = realloc(tags, (ntagspace + 1) * sizeof(*tags));
-			if (!newspace) {
-				err.code = ENOMEM;
-				goto error_out;
-			}
-			tags = (glite_jp_tagval_t *) newspace;
-		}
-	}
-	if (ret == ENOENT) {
-		*tags_out = tags;
-		return 0;
-	} else {
-		err.code = EIO;
-		err.desc = "Error reading tag value";
-	}
-
-error_out:
-	for (; ntags-- ;) {
-		free(tags[ntags].name);
-		free(tags[ntags].value);
-	}
-	free(tags);
-	return glite_jp_stack_error(ctx,&err);
-}
diff --git a/org.glite.jp.client/src/tags.h b/org.glite.jp.client/src/tags.h
deleted file mode 100644
index 0d8afa8..0000000
--- a/org.glite.jp.client/src/tags.h
+++ /dev/null
@@ -1 +0,0 @@
-int glite_jpps_tag_append(glite_jp_context_t,void *,const glite_jp_tagval_t *);
diff --git a/org.glite.jp.client/src/tags_plugin.c b/org.glite.jp.client/src/tags_plugin.c
deleted file mode 100644
index 95dabd8..0000000
--- a/org.glite.jp.client/src/tags_plugin.c
+++ /dev/null
@@ -1,148 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-
-static int tagappend(void *,void *,int,...);
-static int tagopen(void *,void *,const char *uri,void **);
-static int tagclose(void *,void *);
-
-#define TAGS_MAGIC 0x74c016f2	/* two middle digits encode version, i.e. 01 */
-
-static int tagdummy()
-{
-	puts("tagdummy()");
-	return -1;
-}
-
-struct tags_handle {
-	void	*bhandle;
-	int	n;
-	glite_jp_tagval_t	*tags;
-};
-
-int init(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data)
-{
-	data->fpctx = ctx;
-
-	data->uris = calloc(2,sizeof *data->uris);
-	data->uris[0] = strdup(GLITE_JP_FILETYPE_TAGS);
-
-	data->classes = calloc(2,sizeof *data->classes);
-	data->classes[0] = strdup("tags");
-
-	data->ops.open = tagopen;
-	data->ops.close = tagclose;
-	data->ops.attr = tagdummy;
-	data->ops.generic = tagappend;
-	
-	printf("tags_plugin: URI: \"%s\"; magic number: 0x%08lx\n",GLITE_JP_FILETYPE_TAGS,TAGS_MAGIC);
-	return 0;
-}
-
-static int tagopen(void *fpctx,void *bhandle,const char *uri,void **handle)
-{
-	struct tags_handle *h = calloc(1,sizeof *h);
-	h->n = -1;
-	h->bhandle = bhandle;
-
-	*handle = h;
-
-	return 0;
-}
-
-static int tagclose(void *fpctx,void *handle)
-{
-	int	i;
-	struct tags_handle *h = handle;
-
-	for (i=0; in; i++) {
-		free(h->tags[i].name);
-		free(h->tags[i].value);
-	}
-	free(h->tags);
-	free(h);
-
-	return 0;
-}
-
-static int tagappend(void *fpctx,void *handle,int oper,...)
-{
-	glite_jp_tagval_t	*tag;
-	va_list	ap;
-	char	*hdr,*rec;
-	glite_jp_context_t	ctx = fpctx;
-	struct tags_handle	*h = handle;
-	uint32_t		magic,hlen,rlen,rlen_n;
-	size_t			r;
-	glite_jp_error_t	err;
-
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	glite_jp_clear_error(ctx);
-
-	va_start(ap,oper);
-	tag = va_arg(ap,glite_jp_tagval_t *);
-	va_end(ap);
-
-	printf("tagappend: %s,%d,%s\n",tag->name,tag->sequence,tag->value);
-
-	assert(oper == GLITE_JP_FPLUG_TAGS_APPEND);
-
-	if (glite_jppsbe_pread(ctx,h->bhandle,&magic,sizeof magic,0,&r)) {
-		err.code = EIO;
-		err.desc = "reading magic number";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (r == 0) {
-		magic = htonl(TAGS_MAGIC);
-		if (glite_jppsbe_pwrite(ctx,h->bhandle,&magic,sizeof magic,0)) {
-			err.code = EIO;
-			err.desc = "writing magic number";
-			return glite_jp_stack_error(ctx,&err);
-		}
-	}
-	else if (r != sizeof magic) {
-		err.code = EIO;
-		err.desc = "can't read magic number";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	else if (magic != htonl(TAGS_MAGIC)) {
-		err.code = EINVAL;
-		err.desc = "invalid magic number";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	trio_asprintf(&hdr,"%d %ld %c",tag->sequence,
-			tag->timestamp,tag->binary ? 'B' : 'S');
-
-	rlen = strlen(tag->name) + strlen(hdr) + 2 /* \0 after name and after hdr */ +
-		(r = tag->binary ? tag->size : (tag->value ? strlen(tag->value) : 0));
-
-	rlen_n = htonl(rlen);
-
-	rec = malloc(rlen + sizeof rlen_n);
-	*((uint32_t *) rec) = rlen_n;
-	strcpy(rec + sizeof rlen_n,tag->name);
-	strcpy(rec + (hlen = sizeof rlen_n + strlen(tag->name) + 1),hdr);
-
-	if (r) memcpy(rec + hlen + strlen(hdr) + 1,tag->value,r);
-	free(hdr);
-
-	if (glite_jppsbe_append(ctx,h->bhandle,rec,rlen + sizeof rlen_n)) {
-		err.code = EIO;
-		err.desc = "writing tag record";
-		free(rec);
-		return glite_jp_stack_error(ctx,&err);
-	}
-	
-	return 0;
-}
diff --git a/org.glite.jp.client/src/typemap.dat b/org.glite.jp.client/src/typemap.dat
deleted file mode 100644
index 72f515f..0000000
--- a/org.glite.jp.client/src/typemap.dat
+++ /dev/null
@@ -1,3 +0,0 @@
-jpsrv = http://glite.org/wsdl/services/jp
-jptype = http://glite.org/wsdl/types/jp
-jpelem = http://glite.org/wsdl/elements/jp
diff --git a/org.glite.jp.common/.cvsignore b/org.glite.jp.common/.cvsignore
deleted file mode 100644
index 3a4edf6..0000000
--- a/org.glite.jp.common/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-.project
diff --git a/org.glite.jp.common/Makefile b/org.glite.jp.common/Makefile
deleted file mode 100644
index 3f84bcd..0000000
--- a/org.glite.jp.common/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-jp-common
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/project:${jpproject}
-
-GLOBUSINC:= -I${globus_prefix}/include/${nothrflavour}
-
-
-DEBUG:=-g -O0 
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${stagedir}/include \
-	${GLOBUSINC}
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS} -rpath ${stagedir}/lib
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
-INSTALL:=libtool --mode=install install
-COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-
-HDRS:=types.h context.h strmd5.h
-
-SRCS:=context.c strmd5.c attr.c
-OBJS:=${SRCS:.c=.lo}
-
-commonlib:= libglite_jp_common.la
-
-default all: compile
-
-compile: ${commonlib}
-
-${commonlib}: ${OBJS}
-	${LINK} -o $@ ${OBJS}
-
-check: 
-	-echo nothing yet
-
-doc:
-
-stage: compile
-	$(MAKE) install PREFIX=${stagedir}
-
-install:
-	-mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix}
-	cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${jpprefix}
-	-mkdir -p ${PREFIX}/lib
-	${INSTALL} -m 755 ${commonlib} ${PREFIX}/lib
-
-dist: distsrc distbin
-
-# FIXME: just copied from LB
-distsrc:
-	mkdir -p ${top_srcdir}/${package}-${version}
-	cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
-	cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
-	rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
-	$(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
-	save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
-	rm -rf tmpbuilddir
-        
-clean:
-
-%.lo: %.c
-	${COMPILE} -o $@ -c $< 
diff --git a/org.glite.jp.common/build.xml b/org.glite.jp.common/build.xml
deleted file mode 100755
index 6e50854..0000000
--- a/org.glite.jp.common/build.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-	
-	
-	
-	
-
-	
-	
-
-		 
-		
-	
-	 
-	
-	
-	 
-	
- 		
diff --git a/org.glite.jp.common/interface/context.h b/org.glite.jp.common/interface/context.h
deleted file mode 100644
index 20effb2..0000000
--- a/org.glite.jp.common/interface/context.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __GLITE_JP_CONTEXT
-#define __GLITE_JP_CONTEXT
-
-int glite_jp_init_context(glite_jp_context_t *);
-void glite_jp_free_query_rec(glite_jp_query_rec_t *);
-
-char *glite_jp_peer_name(glite_jp_context_t);
-char *glite_jp_error_chain(glite_jp_context_t);
-
-int glite_jp_stack_error(glite_jp_context_t, const glite_jp_error_t *);
-int glite_jp_clear_error(glite_jp_context_t); 
-
-int glite_jp_add_deferred(glite_jp_context_t,int (*)(glite_jp_context_t,void *),void *);
-int glite_jp_run_deferred(glite_jp_context_t);
-
-
-#endif
diff --git a/org.glite.jp.common/interface/strmd5.h b/org.glite.jp.common/interface/strmd5.h
deleted file mode 100755
index c5d76b6..0000000
--- a/org.glite.jp.common/interface/strmd5.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _GLITE_STRMD5_H
-#define _GLITE_STRMD5_H
-
-#ident "$Header$"
-
-/* Compute MD5 sum of the first argument.
- * The sum is returned in the 16-byte array pointed to by 2nd argument
- * 	(if not NULL)
- *
- * Return value: ASCII string of the sum, i.e. 32 characters [0-9a-f]
- * 	(pointer to static area, changed by subsequent calls)
- */
-
-char *strmd5(const char *src, unsigned char *dst);
-
-/**
- * Returns: allocated 32bytes long ASCII string with md5 sum
- * of the first argument
- */
-char *str2md5(const char *src);
-
-/**
- * Returns: allocated 22bytes long ASCII string with md5 sum in base64
- * format of the source argument
- */
-char *str2md5base64(const char *src);
-
-#endif /* _GLITE_STRMD5_H */
diff --git a/org.glite.jp.common/interface/type_plugin.h b/org.glite.jp.common/interface/type_plugin.h
deleted file mode 100644
index bb34744..0000000
--- a/org.glite.jp.common/interface/type_plugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef __GLITE_JP_TYPEPLUGIN
-#define __GLITE_JP_TYPEPLUGIN
-
-typedef struct _glite_jp_tplug_data_t {
-	
-	char	*namespace;
-	void	*pctx;
-
-/** Compare attribute values. 
-  * \param[in] a value to compare
-  * \param[in] b value to compare
-  * \param[out] result like strcmp()
-  * \param[out] err set if the values cannot be compared
-  * \retval 0 OK
-  * \retval other error
-  */
-	int (*cmp)(
-		void	*ctx,
-		const glite_jp_attrval_t *a,
-		const glite_jp_attrval_t *b,
-		int	*result);
-
-/** Convert to and from XML representation */
-	char (*to_xml)(void *,const glite_jp_attrval_t *a);
-	glite_jp_attrval_t (*from_xml)(void *,const char *,const char *);
-
-/** Convert to and from database string representation */
-	char (*to_db)(void *,const glite_jp_attrval_t *a);
-	glite_jp_attrval_t (*from_db)(void *,const char *);
-
-/** Query for database type. 
- * Useful for db column dynamic creation etc.
- */
-	const char (*db_type)(void *,const glite_jp_attr_t *);
-
-} glite_jp_tplug_data_t;
-
-/** Plugin init function.
-    Must be called init, supposed to be called as many times as required
-    for different param's (e.g. xsd files).
- */
-
-typedef int (*glite_jp_tplug_init_t)(
-	glite_jp_context_t	ctx,
-	const char		*param,
-	glite_jp_tplug_data	*plugin_data
-);
-
-#endif
diff --git a/org.glite.jp.common/interface/types.h b/org.glite.jp.common/interface/types.h
deleted file mode 100644
index 06ba2b3..0000000
--- a/org.glite.jp.common/interface/types.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef __GLITE_JP_TYPES
-#define __GLITE_JP_TYPES
-
-#include 
-
-#define GLITE_JP_SYSTEM_NS	"http://egee.cesnet.cz/en/WSDL/jp-system"
-#define GLITE_JP_ATTR_OWNER	GLITE_JP_SYSTEM_NS ":owner"
-
-typedef struct _glite_jp_error_t {
-	int	code;
-	const char	*desc;
-	const char	*source;
-	struct _glite_jp_error_t *reason;
-} glite_jp_error_t;
-
-typedef struct _glite_jp_context {
-	glite_jp_error_t *error;
-	int	(**deferred_func)(struct _glite_jp_context *,void *);
-	void	**deferred_arg;
-	void	*feeds;
-	struct soap	*other_soap;
-	char	*peer;
-	void	**plugins;
-	void	*dbhandle;
-	char	**trusted_peers;
-} *glite_jp_context_t;
-
-typedef enum {
-	GLITE_JP_ATTR_ORIG_ANY,		/**< for queries: don't care about origin */
-	GLITE_JP_ATTR_ORIG_SYSTEM,	/**< JP internal, e.g. job owner */
-	GLITE_JP_ATTR_ORIG_USER,	/**< inserted by user explicitely */
-	GLITE_JP_ATTR_ORIG_FILE		/**< coming from uploaded file */
-} glite_jp_attr_orig_t;
-
-typedef struct {
-	char	*name; 		/**< including namespace */
-	char	*value;
-	int	binary;		/**< value is binary */
-	size_t	size;		/**< in case of binary value */
-	glite_jp_attr_orig_t	origin;	
-	char	*origin_detail;	/**< where it came from, i.e. file URI:name */
-	time_t	timestamp;
-} glite_jp_attrval_t;
-
-
-typedef enum {
-	GLITE_JP_QUERYOP_UNDEF,
-	GLITE_JP_QUERYOP_EQUAL,
-	GLITE_JP_QUERYOP_UNEQUAL,
-	GLITE_JP_QUERYOP_LESS,
-	GLITE_JP_QUERYOP_GREATER,
-	GLITE_JP_QUERYOP_WITHIN,
-	GLITE_JP_QUERYOP__LAST,
-} glite_jp_queryop_t;
-
-typedef struct {
-	char	*attr;
-	glite_jp_queryop_t op;
-	char	*value, *value2;
-	int	binary;
-	size_t	size,size2;
-	glite_jp_attr_orig_t origin;
-} glite_jp_query_rec_t;
-
-void glite_jp_attrval_free(glite_jp_attrval_t *,int);
-
-#endif
diff --git a/org.glite.jp.common/project/build.number b/org.glite.jp.common/project/build.number
deleted file mode 100644
index c680c72..0000000
--- a/org.glite.jp.common/project/build.number
+++ /dev/null
@@ -1 +0,0 @@
-module.build=36
diff --git a/org.glite.jp.common/project/build.properties b/org.glite.jp.common/project/build.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/org.glite.jp.common/project/configure.properties.xml b/org.glite.jp.common/project/configure.properties.xml
deleted file mode 100644
index 5f0ea37..0000000
--- a/org.glite.jp.common/project/configure.properties.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-	
-        
-	                                                                        
-		
-			
-				 
-			
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-jpprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-ares_prefix=${with.ares.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
-			 
-	     
-	 
diff --git a/org.glite.jp.common/project/properties.xml b/org.glite.jp.common/project/properties.xml
deleted file mode 100755
index b9d669d..0000000
--- a/org.glite.jp.common/project/properties.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-	
-	 
diff --git a/org.glite.jp.common/project/tar_exclude b/org.glite.jp.common/project/tar_exclude
deleted file mode 100644
index e1fcd1a..0000000
--- a/org.glite.jp.common/project/tar_exclude
+++ /dev/null
@@ -1,10 +0,0 @@
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
diff --git a/org.glite.jp.common/project/version.properties b/org.glite.jp.common/project/version.properties
deleted file mode 100644
index cd1e9e7..0000000
--- a/org.glite.jp.common/project/version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-module.version=1.0.0
-module.age=1
diff --git a/org.glite.jp.common/src/attr.c b/org.glite.jp.common/src/attr.c
deleted file mode 100644
index 250ef5a..0000000
--- a/org.glite.jp.common/src/attr.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include 
-#include 
-#include 
-
-#include "types.h"
-
-void glite_jp_attrval_free(glite_jp_attrval_t *a,int f)
-{
-	free(a->name);
-	free(a->value);
-	free(a->origin_detail);
-	if (f) free(a);
-}
diff --git a/org.glite.jp.common/src/context.c b/org.glite.jp.common/src/context.c
deleted file mode 100644
index fc7b0bf..0000000
--- a/org.glite.jp.common/src/context.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include 
-#include 
-
-#include "types.h"
-#include "context.h"
-
-int glite_jp_init_context(glite_jp_context_t *ctx)
-{
-	*ctx = calloc(1,sizeof **ctx);
-}
-
-char *glite_jp_peer_name(glite_jp_context_t ctx)
-{
-	return strdup(ctx->peer ? ctx->peer : "unknown");
-}
-
-char *glite_jp_error_chain(glite_jp_context_t ctx)
-{
-	char	*ret = NULL,indent[300] = "";
-	int	len = 0,add;
-	char	buf[2000];
-
-	glite_jp_error_t *ep = ctx->error;
-
-	do {
-		add = snprintf(buf,sizeof buf,"%s%s: %s (%s)\n",
-				indent,
-				ep->source,
-				strerror(ep->code),
-				ep->desc ? ep->desc : "");
-		ret = realloc(ret,len + add + 1);
-		strncpy(ret + len,buf,add); ret[len += add] = 0;
-		strcat(indent,"  ");
-	} while (ep = ep->reason);
-
-	return ret;
-}
-
-int glite_jp_stack_error(glite_jp_context_t ctx, const glite_jp_error_t *err)
-{
-	glite_jp_error_t	*reason = ctx->error;
-
-	ctx->error = calloc(1,sizeof *ctx->error);
-	ctx->error->code = err->code;
-	ctx->error->desc = err->desc ? strdup(err->desc) : NULL;
-	ctx->error->source = err->source ? strdup(err->source) : NULL;
-	ctx->error->reason = reason;
-
-	return err->code;
-}
-
-int glite_jp_clear_error(glite_jp_context_t ctx)
-{
-	glite_jp_error_t	*e = ctx->error, *r;
-
-	while (e) {
-		r = e->reason;
-		free((char *) e->source);
-		free((char *) e->desc);
-		free(e);
-		e = r;
-	}
-	ctx->error = NULL;
-	return 0;
-}
-
-
-void glite_jp_free_query_rec(glite_jp_query_rec_t *q)
-{
-	free(q->attr); 
-	free(q->value);
-	free(q->value2);
-	memset(q,0,sizeof *q);
-}
-
-int glite_jp_queryrec_copy(glite_jp_query_rec_t *dst, const glite_jp_query_rec_t *src)
-{
-	if (src->attr) dst->attr = strdup(src->attr);
-	if (src->value) dst->value = strdup(src->value);
-	if (src->value2) dst->value2 = strdup(src->value2);
-	dst->op = src->op;
-	dst->origin = src->origin;
-	return 0;
-}
-
-int glite_jp_run_deferred(glite_jp_context_t ctx)
-{
-	int	i,cnt,ret;
-
-	if (!ctx->deferred_func) return 0;
-
-	glite_jp_clear_error(ctx);
-	for (cnt=0;ctx->deferred_func[cnt];cnt++);
-	for (i=0; ideferred_func)(ctx,*ctx->deferred_arg)) {
-			glite_jp_error_t	err;
-			char	desc[100];
-
-			sprintf(desc,"calling func #%d, %p",i,*ctx->deferred_func);
-			err.code = ret;
-			err.desc = desc;
-			err.source = "glite_jp_run_deferred()";
-
-			glite_jp_stack_error(ctx,&err);
-			return ret;
-		}
-		else {
-			memmove(ctx->deferred_func,ctx->deferred_func+1,
-					(cnt-i) * sizeof *ctx->deferred_func);
-			memmove(ctx->deferred_arg,ctx->deferred_arg+1,
-					(cnt-i) * sizeof *ctx->deferred_arg);
-		}
-	}
-	free(ctx->deferred_func); ctx->deferred_func = NULL;
-	free(ctx->deferred_arg); ctx->deferred_arg = NULL;
-	return 0;
-}
-
-int glite_jp_add_deferred(
-		glite_jp_context_t ctx,
-		int (*func)(glite_jp_context_t, void *),
-		void *arg
-)
-{
-	int 	(**v)(glite_jp_context_t, void *) = ctx->deferred_func;
-	int	i;
-
-	for (i=0; v && *v; i++);
-
-	ctx->deferred_func = realloc(ctx->deferred_func, (i+1) * sizeof *ctx->deferred_func);
-	ctx->deferred_func[i] = func;
-	ctx->deferred_func[i+1] = NULL;
-
-	ctx->deferred_arg = realloc(ctx->deferred_arg,(i+1) * sizeof *ctx->deferred_arg);
-	ctx->deferred_arg[i] = arg;
-	ctx->deferred_arg[i+1] = NULL;
-
-	return 0;
-}
diff --git a/org.glite.jp.common/src/stdtypes.c b/org.glite.jp.common/src/stdtypes.c
deleted file mode 100644
index 6995e77..0000000
--- a/org.glite.jp.common/src/stdtypes.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include 
-#include 
-#include 
-
-#include "lb/trio.h"
-
-#include "types.h"
-#include "type_plugin.h"
-
-static char *namespace = "http://glite.org/wsdl/types/jp_std_attr";
-
-static int check_namespace(const glite_jp_attr_t *a)
-{
-	if (a->namespace && strcmp(a->namespace,namespace)) return -1;
-	return 0;
-}
-
-static int *cmp(
-	void *ctx,
-	const glite_jp_attrval_t *a,
-	const glite_jp_attrval_t *b,
-	int	*result
-{
-	struct timeval	t;
-	int	r;
-
-	if (check_namespace(&a->attr) || check_namespace(&b->attr)) return -1;
-	if (glite_jp_attr_cmp(&a->attr,&b->attr)) return -1;
-
-	switch (a->attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-			r = strcmp(a->value.s,b->value.s);
-			break;
-		case GLITE_JP_ATTR_TIME:
-			t = a->value.time;
-			t.tv_sec -= b->value.time.tv_sec;
-			if ((t.tv_usec -= b->value.time.tv_usec) < 0) {
-				t.tv_usec += 1000000;
-				t.tv_sec--;
-			}
-			r = t.tv_sec ? t.tv_sec : t.tv_usec;
-			if (r) r = r > 0 ? 1 : -1;
-			break;
-		case GLITE_JP_ATTR_TAG:
-			if (a->value.tag.binary != b->value.tag.binary) return -1;
-			if (a->value.tag.binary) {
-				/* FIXME: I'm lazy. */
-				abort();
-			}
-			else r = strcmp(a->value.tag.value,b->value.tag.value);
-		default: return -1;
-	}
-	*result = r;
-	return 0;
-}
-
-static char *to_xml(void *ctx,const glite_jp_attrval_t *a)
-{
-	char	*out = NULL;
-	
-	if (check_namespace(a)) return NULL;
-
-	switch (a->attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-			trio_asprintf(&out,"%|Xs",a->value.s);
-			break;
-		case GLITE_JP_ATTR_TIME:
-			/* XXX */
-			trio_asprintf(&out,"%ld.06%ld",a->value.time.tv_sec,
-					a->value.time.tv_usec);
-			break;
-		case GLITE_JP_ATTR_TAG:
-			/* FIXME */ assert(!a->value.tag.binary);
-
-			trio_asprintf(&out,"%d %ld> %|Xs",a->value.tag.sequence,a->value.tag.timestamp,a->value.tag.value);
-			break;
-		default:
-			break;
-	}
-	return out;
-}
-
-static glite_jp_attrval_t *from_xml(void *ctx,const char *name,const char *val)
-{
-	/* FIXME: I'm lazy. */
-	abort();
-}
-
-static char *to_db(void *ctx,const glite_jp_attrval_t *a)
-{
-	/* FIXME: I'm lazy. */
-	abort();
-}
-
-static glite_jp_attrval_t *from_db(void *ctx,const char *a)
-{
-	/* FIXME: I'm lazy. */
-	abort();
-}
-
-static const char *db_type(void *ctx,const glite_jp_attr_t *a)
-{
-	if check_namespace(a) return NULL;
-	switch (a->type) {
-		case GLITE_JP_ATTR_OWNER: return "varchar(250) binary";
-		case GLITE_JP_ATTR_TIME: return "datetime";
-		case GLITE_JP_ATTR_TAG: return "mediumblob";
-		default: return NULL;
-	}
-}
-
-int init(
-	glite_jp_context_t	ctx,
-	const char		*param,
-	glite_jp_tplug_data     *pd
-)
-{
-	pd->namespace = namespace;
-	pd->cmp = cmp;
-	pd->to_xml = to_xml;
-	pd->from_xml = from_xml;
-	pd->to_db = to_db;
-	pd->from_db = from_db;
-	pd->db_type = db_type;
-	pd->pctx = ctx;
-}
-
diff --git a/org.glite.jp.common/src/strmd5.c b/org.glite.jp.common/src/strmd5.c
deleted file mode 100755
index 87fd400..0000000
--- a/org.glite.jp.common/src/strmd5.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-#include "strmd5.h"
-
-static char mbuf[33];
-
-static int base64_encode(const void *enc, int enc_size, char *out, int out_max_size)
-{
-    static const char* b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-
-    unsigned char* enc_buf = (unsigned char*)enc;
-    int		  out_size = 0;
-    unsigned int  bits = 0;
-    unsigned int  shift = 0;
-
-    while ( out_size < out_max_size ) {
-	if ( enc_size>0 ) {
-	    // Shift in byte
-	    bits <<= 8;
-	    bits |= *enc_buf;
-	    shift += 8;
-	    // Next byte
-	    enc_buf++;
-	    enc_size--;
-	} else if ( shift>0 ) {
-	    // Pad last bits to 6 bits - will end next loop
-	    bits <<= 6 - shift;
-	    shift = 6;
-	} else {
-	    // Terminate with Mime style '='
-	    *out = '=';
-	    out_size++;
-
-	    return out_size;
-	}
-
-	// Encode 6 bit segments
-	while ( shift>=6 ) {
-	    shift -= 6;
-	    *out = b64[ (bits >> shift) & 0x3F ];
-	    out++;
-	    out_size++;
-	}
-    }
-
-    // Output overflow
-    return -1;
-}
-
-char *strmd5(const char *s, unsigned char *digest)
-{
-    MD5_CTX md5;
-    unsigned char d[16];
-    int	i;
-
-    MD5_Init(&md5);
-    MD5_Update(&md5,s,strlen(s));
-    MD5_Final(d,&md5);
-
-    if (digest) memcpy(digest,d,sizeof(d));
-
-    for (i=0; i<16; i++) {
-	int	dd = d[i] & 0x0f;
-	mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
-	dd = d[i] >> 4;
-	mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a';
-    }
-    mbuf[32] = 0;
-    return (char *) mbuf;
-}
-
-char *str2md5(const char *s)
-{
-    MD5_CTX md5;
-    unsigned char d[16];
-    char* ret = malloc(33);
-    int	i;
-
-    if (!ret)
-	return NULL;
-
-    MD5_Init(&md5);
-    MD5_Update(&md5, s, strlen(s));
-    MD5_Final(d, &md5);
-
-    for (i=0; i<16; i++) {
-	int  dd = d[i] & 0x0f;
-	ret[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
-	dd = d[i] >> 4;
-	ret[2*i] = dd<10 ? dd+'0' : dd-10+'a';
-    }
-    ret[32] = 0;
-    return ret;
-}
-
-char *str2md5base64(const char *s)
-{
-    MD5_CTX md5;
-    unsigned char d[16];
-    char buf[50];
-    int l;
-
-    MD5_Init(&md5);
-    MD5_Update(&md5, s, strlen(s));
-    MD5_Final(d, &md5);
-
-    l = base64_encode(d, 16, buf, sizeof(buf) - 1);
-    if (l < 1)
-	return NULL;
-    buf[l - 1] = 0;
-    return strdup(buf);
-}
diff --git a/org.glite.jp.index/.cvsignore b/org.glite.jp.index/.cvsignore
deleted file mode 100644
index 3a4edf6..0000000
--- a/org.glite.jp.index/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-.project
diff --git a/org.glite.jp.index/Makefile b/org.glite.jp.index/Makefile
deleted file mode 100644
index 3b893cd..0000000
--- a/org.glite.jp.index/Makefile
+++ /dev/null
@@ -1,129 +0,0 @@
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-lb-server
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${jpproject}
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
-	-lglobus_common_${nothrflavour} \
-	-lglobus_gssapi_gsi_${nothrflavour}
-
-DEBUG:=-g -O0  -DDEBUG
-
-CFLAGS:=${DEBUG} -I. -I${gsoap_prefix}/include -I${stagedir}/include
-LDFLAGS:=-L${stagedir}/lib
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS} 
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
-INSTALL:=libtool --mode=install install
-
-
-daemon:=glite-jp-indexd
-example:=jpis-test
-soap_prefix:=jpis_
-
-SRCS:= simple_server.c soap_ops.c \
-	${soap_prefix}C.c \
-	${soap_prefix}Server.c
-
-EXA_SRCS:=jpis-test.c ${soap_prefix}C.c ${soap_prefix}Client.c
-
-
-OBJS:=${SRCS:.c=.o} stdsoap2.o
-EXA_OBJS:=${EXA_SRCS:.c=.o} stdsoap2.o
-
-COMMONLIB:=-lglite_jp_common
-
-default all: compile
-
-compile: ${daemon} ${example}
-
-${daemon}: ${OBJS}
-	${LINK} -o $@ ${OBJS} ${COMMONLIB} ${GLOBUS_LIBS}
-
-${example}: ${EXA_OBJS}
-	${LINK} -o $@ ${EXA_OBJS}
-
-JobProvenanceIS.xh: JobProvenanceIS.wsdl JobProvenanceTypes.wsdl typemap.dat
-	cp  ${jpproject}/JobProvenanceTypes.wsdl .
-	${gsoap_prefix}/bin/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
-	rm -f JobProvenanceTypes.wsdl
-
-${soap_prefix}C.c ${soap_prefix}H.h: JobProvenanceIS.xh
-	${gsoap_prefix}/bin/soapcpp2 -w -c -p ${soap_prefix} JobProvenanceIS.xh
-
-#$(SOAP_PREFIX)H.h $(SOAP_PREFIX)C.c: LB.xh
-#        $(GSOAP_BIN_PATH)/soapcpp2 -w -c -p $(SOAP_PREFIX) LB.xh
-#
-#LB.xh: LB.wsdl typemap.dat
-#         $(GSOAP_BIN_PATH)/wsdl2h -c -o $@ LB.wsdl
-#
-
-
-check: 
-	-echo nothing yet
-
-doc:
-
-stage: compile
-	${INSTALL} -m 755 ${daemon} ${stagedir}/bin
-
-dist: distsrc distbin
-
-# FIXME: just copied from LB
-distsrc:
-	mkdir -p ${top_srcdir}/${package}-${version}
-	cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
-	cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
-	rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
-	$(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
-	save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
-	rm -rf tmpbuilddir
-        
-install:
-	-mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/init.d
-	for p in bkserverd bkindex; do \
-		${INSTALL} -m 755 "glite_lb_$$p" "${PREFIX}/bin/glite-lb-$$p"; \
-	done
-
-	for f in dbsetup.sql index.conf.template; do \
-		${INSTALL} -m 644 ${top_srcdir}/config/"glite-lb-$$f" ${PREFIX}/etc; \
-	done
-
-	${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-lb-bkserverd
-
-clean:
-
-soap_ops.o jpis-test.o simple_server.o: ${soap_prefix}H.h
-
-# we have no real config.h but have to force gSoap not to use
-# linux ftime with broken (aka obsolete) DST information
-
-stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c
-	test -f config.h || touch config.h
-	@echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless'
-	${CC} -o $@ -c -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c
-
diff --git a/org.glite.jp.index/build.xml b/org.glite.jp.index/build.xml
deleted file mode 100755
index 3a97943..0000000
--- a/org.glite.jp.index/build.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-	
-	
-	
-	
-
-	
-	
-
-		 
-		
-	
-	 
-	
-	
-	 
-	
- 		
diff --git a/org.glite.jp.index/project/JobProvenanceIS.wsdl b/org.glite.jp.index/project/JobProvenanceIS.wsdl
deleted file mode 100644
index 26f97a4..0000000
--- a/org.glite.jp.index/project/JobProvenanceIS.wsdl
+++ /dev/null
@@ -1,531 +0,0 @@
-
-
-	
-		
-			
-				
-				 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-				
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			
-				
-					 
-			 
-			 
-	 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		 
-	
-		
-			Register job with JP primary storage.
-Job registration in LB is propagated to JP immediately so that JP is aware of the job,
-despite no furhter information is available in it.
-
-Input: JobId
-
-Output: N/A
-
-Faults: GenericJPFault
-			 
-			 
-		
-			Initiate upload of of sandbox/dump of job life log from LB.
-WM component responsible for job sandbox management and LB server call JP to declare
-intention to upload intput/output sandbox and job life log.
-
-Input:
-
-uclass: type of the upload - INPUT_SANDBOX, OUTPUT_SANDBOX, JOB_LOG
-
-commitTimeout: upper limit on time for which JP waits for committing this upload transaction
-
-contentType: MIME type of the uploaded file
-
-Output:
-
-destination: URL where the client should upload the file
-
-commitBefore: acutual time when the upload transaction times out
-
-Faults: GenericJPFault
-
-
-Initiate upload of of sandbox/dump of job life log from LB. 
-			 
-		
-			Confirm upload.
-Should be called after a file upload initiaded with StartUpload is finished.
-
-Input:
-
-destination: Upload destination URL (to match with the original request)
-
-Output:
-
-Faults: GenericJPFault
-			 
-			 
-		
-			Record a value of user tag.
-JP tags are either standalone or override values of their LB counterparts.
-However, JP tag values are still distinguishable those inherited from LB.
-JP tags may be either strings or blobs.
-
-Input:
-
-jobid:
-
-tag: structure containing name, timestamp, optional sequence number to order tag values
-without relying on timestamps, and string or blob value.
-
-Output: N/A
-
-Faults: GenericJPFault
-			 
-			 
-		
-			Start feeding JP index server.
-Called by the index server to start batch feed, and optionally also subscribe for incremental feed.
-
-JP index server subscribes with JP primary storage using a query
-containing conditions on primary metadata and a list of queryable attributes
-of the index server (i.e. data which should be sent to the index server).
-
-When a matching job record is created or modified within the primary storage
-the job record data are sent to the subscribed index server.
-
-The subscription is soft-state, it expires after certain time unless refreshed by the client explicitely.
-
-In the batch mode the query has the same form
-with additional flag asking for all matching records (i.e.\ not only
-arriving afterwards).
-
-Input:
-
-destination: where to send the job record data
-
-attributes: which job record attributes should be sent to the requesting index server
-
-conditions: list of query conditions. Each conditions has the form Attribute Operator Value,
-where Attribute is any of job record attributes and Operator is one of EQUAL, UNEQUAL, LESS, GREATER, WITHIN.
-
-continuous: flag determining that the query is incremental (not batch) 
-
-Output:
-
-feedId: unique Id of the feed request, to be used in refresh, cancelation etc.
-
-expires: when the feed times out. Must be refreshed before this time.
-
-Faults: GenericJPFault
-			 
-			 
-		
-			Extend batch feed subscription (used by index server)
-
-Input: feedId returned previously by FeedIndex
-
-Output: the same as for FeedIndex
-
-Faults: GenericJPFault
-			 
-			 
-		
-			Retrieve job record URL's when jobid is known
-Used either to bypass JP index server query for this specific case, or after the index server query to
-retrieve actual job record.
-
-Input: jobid
-
-Output:
-
-jobLog, inputSandbox, outputSandbox, tags: URL's to components of the job record.
-
-Faults: GenericJPFault
-			 
-			 
-	 
-	
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-	 
-	
-		Job Provenance Primary Storage service 
-		
-			 
-	 
-
-	
-		 
-
-	
-		 
-		
-	
-		 
-	
-	
-		
-			Store or update information on jobs within the JP index server.
-Called directly by the primary storage, used for both batch and incremental feed.
-
-Input:
-
-data: list of job record updates. Each contains jobid, list of JP attribute values and user tag values.
-
-feedDone: flag indicating end of batch feed. (In order to avoid potential problems with buffer allocation
-the huge dataset of batch feed is split into reasonable chunks and delivered with more UpdateJobs calls.)
-
-Output: N/A
-
-Faults: GenericJPFault
-
-
-			 
-			 
-		
-			Retrieve pointers to job records of jobs matching a query.
-Input: conditions - list of lists of query conditions.
-	Elements of the inner lists refer to a single job attribute, the conditions are or-ed.
-	Elements of the outer list may refer to different job attributes, they are and-ed.
-
-Output:
-
-jobs: list of JobId, PSContact (URL of the primary storage which manges this job) pairs
-
-Faults: GenericJPFault
-			 
-			 
-	 
-
-	
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-	 
-
-	
-		Job Provenance Index service 
-		
-			 
-	 
-		
-
- 
diff --git a/org.glite.jp.index/project/build.number b/org.glite.jp.index/project/build.number
deleted file mode 100644
index 95388e3..0000000
--- a/org.glite.jp.index/project/build.number
+++ /dev/null
@@ -1 +0,0 @@
-module.build=9
diff --git a/org.glite.jp.index/project/build.properties b/org.glite.jp.index/project/build.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/org.glite.jp.index/project/configure.properties.xml b/org.glite.jp.index/project/configure.properties.xml
deleted file mode 100644
index 72af8f4..0000000
--- a/org.glite.jp.index/project/configure.properties.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-	
-        
-	                                                                        
-		
-			
-				 
-			
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-ares_prefix=${with.ares.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
-			 
-	     
-	 
diff --git a/org.glite.jp.index/project/properties.xml b/org.glite.jp.index/project/properties.xml
deleted file mode 100755
index 5f56392..0000000
--- a/org.glite.jp.index/project/properties.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-	
-	 
diff --git a/org.glite.jp.index/project/tar_exclude b/org.glite.jp.index/project/tar_exclude
deleted file mode 100644
index e1fcd1a..0000000
--- a/org.glite.jp.index/project/tar_exclude
+++ /dev/null
@@ -1,10 +0,0 @@
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
diff --git a/org.glite.jp.index/project/version.properties b/org.glite.jp.index/project/version.properties
deleted file mode 100644
index cd1e9e7..0000000
--- a/org.glite.jp.index/project/version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-module.version=1.0.0
-module.age=1
diff --git a/org.glite.jp.index/src/simple_server.c b/org.glite.jp.index/src/simple_server.c
deleted file mode 100644
index ccaa5a7..0000000
--- a/org.glite.jp.index/src/simple_server.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpis_H.h"
-
-int main() {
-   struct soap soap;
-   int i, m, s; // master and slave sockets
-
-   glite_jp_context_t	ctx;
-
-   soap_init(&soap);
-   glite_jp_init_context(&ctx);
-   soap.user = (void *) ctx;
-
-   srand48(time(NULL)); /* feed id generation */
-
-   m = soap_bind(&soap, NULL, 8902, 100);
-   if (m < 0)
-      soap_print_fault(&soap, stderr);
-   else
-   {
-      fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
-      for (i = 1; ; i++) {
-         s = soap_accept(&soap);
-         if (s < 0) {
-            soap_print_fault(&soap, stderr);
-            break;
-         }
-         soap_serve(&soap); // process RPC request
-         soap_destroy(&soap); // clean up class instances
-         soap_end(&soap); // clean up everything and close socket
-	 glite_jp_run_deferred(ctx);
-      }
-   }
-   soap_done(&soap); // close master socket
-
-   return 0;
-}
diff --git a/org.glite.jp.index/src/soap_ops.c b/org.glite.jp.index/src/soap_ops.c
deleted file mode 100644
index 5af7352..0000000
--- a/org.glite.jp.index/src/soap_ops.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpis_H.h"
-#include "JobProvenanceIS.nsmap"
-
-static struct jptype__GenericJPFaultType *jp2s_error(struct soap *soap,
-		const glite_jp_error_t *err)
-{
-	struct jptype__GenericJPFaultType *ret = NULL;
-	if (err) {
-		ret = soap_malloc(soap,sizeof *ret);
-		memset(ret,0,sizeof *ret);
-		ret->code = err->code;
-		ret->source = soap_strdup(soap,err->source);
-		ret->text = soap_strdup(soap,strerror(err->code));
-		ret->description = soap_strdup(soap,err->desc);
-		ret->reason = jp2s_error(soap,err->reason);
-	}
-	return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
-	char	*et;
-	struct SOAP_ENV__Detail	*detail = soap_malloc(soap,sizeof *detail);
-	struct _GenericJPFault *f = soap_malloc(soap,sizeof *f);
-
-
-	f->jptype__GenericJPFault = jp2s_error(soap,ctx->error);
-
-	detail->__type = SOAP_TYPE__GenericJPFault;
-	detail->value = f;
-	detail->__any = NULL;
-
-	soap_receiver_fault(soap,"Oh, shit!",NULL);
-	if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
-	else soap->fault->detail = detail;
-}
-
-static void s2jp_tag(const struct jptype__TagValue *stag,glite_jp_tagval_t *jptag)
-{
-	memset(jptag,0,sizeof *jptag);
-	jptag->name = strdup(stag->name);
-	jptag->sequence = stag->sequence ? *stag->sequence : 0;
-	jptag->timestamp = stag->timestamp ? *stag->timestamp : 0;
-	if (stag->stringValue) jptag->value = strdup(stag->stringValue);
-	else if (stag->blobValue) {
-		jptag->binary = 1;
-		jptag->size = stag->blobValue->__size;
-		jptag->value = (char *) stag->blobValue->__ptr;
-	}
-}
-
-#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t	ctx = (glite_jp_context_t) ((soap)->user)
-
-SOAP_FMAC5 int SOAP_FMAC6 jpsrv__UpdateJobs(
-	struct soap *soap,
-	char *feed_id,
-	struct jptype__UpdateJobsData *jobs,
-	enum xsd__boolean done
-)
-{
-	printf("%s items %d jobid %s\n",__FUNCTION__,jobs->__sizejob,
-			jobs->job[0]->jobid);
-	return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 jpsrv__QueryJobs(
-	struct soap *soap,
-	struct jptype__IndexQuery *query,
-	struct jpsrv__QueryJobsResponse *resp
-)
-{
-	puts(__FUNCTION__);
-	return SOAP_OK;
-}
-
diff --git a/org.glite.jp.index/src/typemap.dat b/org.glite.jp.index/src/typemap.dat
deleted file mode 100644
index 7032cb2..0000000
--- a/org.glite.jp.index/src/typemap.dat
+++ /dev/null
@@ -1,2 +0,0 @@
-jpsrv = http://glite.org/wsdl/services/jp
-jptype = http://glite.org/wsdl/types/jp
diff --git a/org.glite.jp.primary/.cvsignore b/org.glite.jp.primary/.cvsignore
deleted file mode 100644
index 3a4edf6..0000000
--- a/org.glite.jp.primary/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-.project
diff --git a/org.glite.jp.primary/Makefile b/org.glite.jp.primary/Makefile
deleted file mode 100644
index 73d1c5a..0000000
--- a/org.glite.jp.primary/Makefile
+++ /dev/null
@@ -1,186 +0,0 @@
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-jpprefix=jp
-package=glite-jp-primary
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${stagedir}/interface
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
-	-lglobus_common_${nothrflavour} \
-	-lglobus_gssapi_gsi_${nothrflavour}
-
-GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
-
-DEBUG:=-g -O0  -DDEBUG
-
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql
-LDFLAGS:=-L${stagedir}/lib
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS} 
-LTCOMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-SOLINK:=libtool --mode=link ${CC} -module ${LDFLAGS} -rpath ${stagedir}/lib
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
-INSTALL:=libtool --mode=install install
-
-daemon:=glite-jp-primarystoraged
-example:=jpps-test
-ps_prefix:=jpps_
-is_prefix:=jpis_
-
-plugins:=glite-jp-tags.la
-
-HDRS_I=file_plugin.h
-HDRS_S=builtin_plugins.h backend.h
-
-SRCS:= bones_server.c soap_ops.c \
-	new_ftp_backend.c mysql.c file_plugin.c \
-	feed.c authz.c\
-	is_client.c \
-	${ps_prefix}ServerLib.c \
-	${is_prefix}ClientLib.c jpps_C.c
-#	env_C.c
-
-EXA_SRCS:=jpps-test.c ${ps_prefix}C.c ${ps_prefix}Client.c
-
-
-OBJS:=${SRCS:.c=.o}
-EXA_OBJS:=${EXA_SRCS:.c=.o}
-
-COMMONLIB:=-lglite_jp_common
-BONESLIB:=-lglite_lb_server_bones
-GSOAPLIB:=-lglite_security_gsoap_plugin_${nothrflavour} -lglite_security_gss_${nothrflavour} \
-	-L${gsoap_prefix}/lib -lgsoap${GSOAP_DEBUG} -L${ares_prefix}/lib -lares
-TRIOLIB:=-lglite_lb_trio
-
-ifneq (${mysql_prefix},/usr)
-	ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
-		MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
-        else
-		MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
-        endif
-else
-	MYSQLIB := -lmysqlclient
-endif
-
-default all: compile
-
-compile: ${daemon} ${example} ${plugins}
-
-${daemon}: ${OBJS}
-	${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${MYSQLIB} 
-
-${example}: ${EXA_OBJS}
-	${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} ${GLOBUS_LIBS}
-
-# XXX: piss off
-JobProvenanceIS.xh:
-	touch $@
-
-JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat
-	cp  ${stagedir}/interface/JobProvenanceTypes.wsdl .
-	${gsoap_prefix}/bin/wsdl2h  -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
-	rm -f JobProvenanceTypes.wsdl
-
-${ps_prefix}Client.c ${ps_prefix}ClientLib.c  \
-${ps_prefix}Server.c ${ps_prefix}ServerLib.c  \
-${ps_prefix}C.c ${ps_prefix}H.h: JobProvenancePS.xh
-	${gsoap_prefix}/bin/soapcpp2 -n -w -c -p ${ps_prefix} JobProvenancePS.xh
-
-${is_prefix}ClientLib.c ${is_prefix}Client.c \
-${is_prefix}C.c ${is_prefix}H.h: JobProvenanceIS.xh
-	${gsoap_prefix}/bin/soapcpp2 -n -w -c -p ${is_prefix} JobProvenanceIS.xh
-
-env_C.c env_Server.c:
-	touch env.xh
-	cp  ${jpproject}/JobProvenanceTypes.wsdl .
-	${gsoap_prefix}/bin/wsdl2h  -t ${top_srcdir}/src/typemap.dat -c -o env.xh JobProvenanceTypes.wsdl
-	rm -f JobProvenanceTypes.wsdl
-	${gsoap_prefix}/bin/soapcpp2 -w -c -p env_ env.xh
-
-#$(SOAP_PREFIX)H.h $(SOAP_PREFIX)C.c: LB.xh
-#        $(GSOAP_BIN_PATH)/soapcpp2 -w -c -p $(SOAP_PREFIX) LB.xh
-#
-#LB.xh: LB.wsdl typemap.dat
-#         $(GSOAP_BIN_PATH)/wsdl2h -c -o $@ LB.wsdl
-#
-
-
-bones_server.o simple_server.o: ${is_prefix}H.h ${ps_prefix}H.h
-
-check: 
-	-echo nothing yet
-
-doc:
-
-stage: compile
-	${MAKE} PREFIX=${stagedir} DOSTAGE=yes install
-
-dist: distsrc distbin
-
-distsrc:
-	mkdir -p ${top_srcdir}/${package}-${version}
-	cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
-	cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
-	rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
-	$(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
-	save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
-	rm -rf tmpbuilddir
-        
-install:
-	-mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/examples ${PREFIX}/etc/init.d
-	${INSTALL} -m 755 ${daemon} ${PREFIX}/bin
-	${INSTALL} -m 755 jpps-test ${PREFIX}/examples/glite-jp-primary-test
-	if [ x${DOSTAGE} = xyes ]; then \
-		mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix} ; \
-		(cd ${top_srcdir}/interface && install -m 644 ${HDRS_I} ${PREFIX}/include/${globalprefix}/${jpprefix}) ; \
-		(cd ${top_srcdir}/src && install -m 644 ${HDRS_S} ${PREFIX}/include/${globalprefix}/${jpprefix}) ; \
-	fi
-
-
-clean:
-
-simple_server.o soap_ops.o jpps-test.o: ${ps_prefix}H.h
-
-# we have no real config.h but have to force gSoap not to use
-# linux ftime with broken (aka obsolete) DST information
-
-stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c
-	test -f config.h || touch config.h
-	@echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless'
-	${CC} -o $@ -c -DWITH_NONAMESPACES -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c
-
-
-glite-jp-tags.la: tags_plugin.lo
-	${SOLINK} -o $@ tags_plugin.lo
-
-%.lo: %.c
-	${LTCOMPILE} -o $@ -c $<
-
-soap_ops.o bones_server.o: soap_version.h
-
-soap_version.h:
-	${gsoap_prefix}/bin/soapcpp2 /dev/null
-	perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
-	-rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp 
diff --git a/org.glite.jp.primary/build.xml b/org.glite.jp.primary/build.xml
deleted file mode 100755
index 439631b..0000000
--- a/org.glite.jp.primary/build.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-	
-	
-	
-	
-
-	
-	
-
-		 
-		
-	
-	 
-	
-	
-	 
-	
- 		
diff --git a/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql b/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql
deleted file mode 100644
index f253f1d..0000000
--- a/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql
+++ /dev/null
@@ -1,46 +0,0 @@
-create table jobs (
-	jobid		char(32)	binary not null,
-	dg_jobid	varchar(255)	binary not null,
-	owner		char(32)	binary not null,
-
-	reg_time	datetime	not null,
-	
-	primary key (jobid),
-	unique (dg_jobid),
-	index (owner),
-	index (owner,reg_time)
-);
-
-create table files (
-	jobid		char(32)	binary not null,
-	filename	varchar(255)	binary not null,
-	int_path	mediumblob	null,
-	ext_url		mediumblob	null,
-
-	state		char(32)	binary not null,
-	deadline	datetime	null,
-	ul_userid	char(32)	binary not null,
-
-	primary key (jobid,filename),
-	index (ext_url(255))
-);
-
-create table attrs (
-	jobid		char(32)	binary not null,
-	name		varchar(255)	binary not null,
-	value		mediumblob	null,
-
-	primary key (jobid,name)
-);
-
-create table users (
-	userid		char(32)	binary not null,
-	cert_subj	varchar(255)	binary not null,
-
-	primary key (userid),
-	unique (cert_subj)
-);
-
-create table backend_info (
-	version		char(32)	binary not null
-);
diff --git a/org.glite.jp.primary/examples/README.test b/org.glite.jp.primary/examples/README.test
deleted file mode 100644
index 6bfe1d8..0000000
--- a/org.glite.jp.primary/examples/README.test
+++ /dev/null
@@ -1,40 +0,0 @@
-Create database:
-----------------
-
-$ mysqladmin -u root -p create jpps 
-$ mysql -u root -p
-mysql> grant all privileges on jpps.* to jpps@localhost identified by '';
-
-$ mysql -p -u jpps jpps 
-#include 
-#include 
-#include 
-
-#include "glite/security/glite_gsplugin.h"
-
-#include "jpps_H.h"
-#include "jpps_.nsmap"
-
-#include "jptype_map.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
-#define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload
-#define soap_call___jpsrv__CommitUpload soap_call___ns1__CommitUpload
-#define soap_call___jpsrv__RecordTag soap_call___ns1__RecordTag
-#define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex
-#define soap_call___jpsrv__FeedIndexRefresh soap_call___ns1__FeedIndexRefresh
-#define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
-#endif
-
-
-static void usage(const char *me)
-{
-	fprintf(stderr,"%s: [-s server-url] operation args \n\n"
-			"	operations are:\n"
-			"		RegisterJob jobid owner\n"
-			"		StartUpload jobid class commit_before mimetype\n"
-			"		CommitUpload destination\n"
-			"		RecordTag jobid tagname sequence stringvalue\n"
-			"		GetJob jobid\n"
-			"		FeedIndex destination query_number history continuous\n"
-			"		FeedIndexRefresh feedid\n"
-		,me);
-
-	exit (EX_USAGE);
-}
-	
-static int check_fault(struct soap *soap,int err) {
-	struct SOAP_ENV__Detail *detail;
-	struct jptype__genericFault	*f;
-	char	*reason,indent[200] = "  ";
-
-	switch(err) {
-		case SOAP_OK: puts("OK");
-			      break;
-		case SOAP_FAULT:
-		case SOAP_SVR_FAULT:
-			if (soap->version == 2) {
-				detail = soap->fault->SOAP_ENV__Detail;
-				reason = soap->fault->SOAP_ENV__Reason;
-			}
-			else {
-				detail = soap->fault->detail;
-				reason = soap->fault->faultstring;
-			}
-			fputs(reason,stderr);
-			putc('\n',stderr);
-			assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
-			f = ((struct _genericFault *) detail->fault)
-#else
-			f = ((struct _genericFault *) detail->value)
-#endif
-				-> jpelem__genericFault;
-
-			while (f) {
-				fprintf(stderr,"%s%s: %s (%s)\n",indent,
-						f->source,f->text,f->description);
-				f = f->reason;
-				strcat(indent,"  ");
-			}
-			return -1;
-
-		default: soap_print_fault(soap,stderr);
-			 return -1;
-	}
-	return 0;
-}
-
-/* FIXME: new wsdl */
-#if 0
-static struct jptype__Attribute sample_attr[] = {
-			{ OWNER, NULL },
-			{ TIME, "submitted" },
-			{ TAG, "test" },
-};
-
-static struct jptype__PrimaryQueryElement sample_query[][5] = {
-	{
-		{ sample_attr+OWNER, EQUAL, "unknown", NULL },
-		{ NULL, 0, NULL, NULL }
-	},
-};
-#endif
-
-int main(int argc,char *argv[])
-{
-	char	*server = "http://localhost:8901";
-	int	opt;
-	struct soap	*soap = soap_new();
-
-	if (argc < 2) usage(argv[0]); 
-
-	soap_init(soap);
-	soap_set_namespaces(soap, jpps__namespaces);
-
-	soap_register_plugin(soap,glite_gsplugin);
-
-	while ((opt = getopt(argc,argv,"s:")) >= 0) switch (opt) {
-		case 's': server = optarg;
-			  argv += 2;
-			break;
-		case '?': usage(argv[0]);
-	}
-
-	if (!strcasecmp(argv[1],"RegisterJob")) {
-		struct _jpelem__RegisterJob	in;
-		struct _jpelem__RegisterJobResponse	empty;
-
-		if (argc != 4) usage(argv[0]);
-		in.job = argv[2];
-		in.owner = argv[3];
-		check_fault(soap,
-			soap_call___jpsrv__RegisterJob(soap,server,"",&in,&empty));
-	} else if (!strcasecmp(argv[1], "StartUpload")) {
-		struct _jpelem__StartUpload		in;
-		struct _jpelem__StartUploadResponse	out;
-
-		in.job = argv[2];
-		in.class_ = argv[3];
-		in.name = NULL;
-		in.commitBefore = atoi(argv[4]) + time(NULL);
-		in.contentType = argv[5];
-
-		if (argc != 6) usage(argv[0]);
-		if (!check_fault(soap,
-				soap_call___jpsrv__StartUpload(soap, server, "",&in,&out)))
-		{
-			printf("Destination: %s\nCommit before: %s\n", out.destination, ctime(&out.commitBefore));
-		}
-	} else if (!strcasecmp(argv[1], "CommitUpload")) {
-		struct _jpelem__CommitUpload	in;
-		struct _jpelem__CommitUploadResponse	empty;
-
-		in.destination = argv[2];
-
-		if (argc != 3) usage(argv[0]);
-		if (!check_fault(soap,
-				soap_call___jpsrv__CommitUpload(soap, server, "",&in,&empty))) {
-			/* OK */
-		}
-	} else if (!strcasecmp(argv[1], "RecordTag")) {
-		struct _jpelem__RecordTag	in;
-		struct _jpelem__RecordTagResponse	empty;
-		struct jptype__tagValue tagval;
-		
-		int seq = 0;
-	
-		if (argc != 6) usage(argv[0]);
-		
-		in.jobid = argv[2];
-		in.tag = &tagval;
-		tagval.name = argv[3];
-		seq = atoi(argv[4]);
-		tagval.sequence = &seq;
-		tagval.timestamp = NULL;
-		tagval.stringValue = argv[5];
-		tagval.blobValue = NULL;
-		
-		if (!check_fault(soap,
-				soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty))) {
-			/* OK */
-		}
-	} 
-/* FIXME: new wsdl  */
-#if 0
-   	 else if (!strcasecmp(argv[1],"FeedIndex")) {
-		struct jpsrv__FeedIndexResponse	r;
-		struct jptype__Attribute	*ap[2];
-		struct jptype__Attributes	attr = { 2, ap };
-		struct jptype__PrimaryQueryElement *qp[100];
-		struct jptype__PrimaryQuery	qry = { 0, qp }; 
-
-		int	i,j,qi = atoi(argv[3])-1;
-
-		if (argc != 6) usage(argv[0]);
-
-		for (i=0; iclass_,
-						out.files[i]->name,
-						out.files[i]->url);
-			}
-		}
-
-	}
-	else usage(argv[0]);
-
-	return 0;
-}
-
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
diff --git a/org.glite.jp.primary/interface/file_plugin.h b/org.glite.jp.primary/interface/file_plugin.h
deleted file mode 100644
index eae219d..0000000
--- a/org.glite.jp.primary/interface/file_plugin.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef __GLITE_JP_FILEPLUGIN
-#define __GLITE_JP_FILEPLUGIN
-
-/** Methods of the file plugin. */
-
-typedef struct _glite_jpps_fplug_op_t {
-
-/** Open a file.
-\param[in] fpctx	Context of the plugin, returned by its init.
-\param[in] bhandle	Handle of the file via JPPS backend.
-\param[in] uri		URI (type) of the opened file.
-\param[out] handle	Handle to the opened file structure, to be passed to other plugin functions.
-*/
-	int	(*open)(void *fpctx,void *bhandle,const char *uri,void **handle);
-
-/** Close the file. Free data associated to a handle */
-	int	(*close)(void *fpctx,void *handle);
-
-/** Retrieve value(s) of an attribute.
-\param[in] fpctx	Plugin context.
-\param[in] handle	Handle of the opened file.
-\param[in] attr		Queried attribute.
-\param[out] attrval	GLITE_JP_ATTR_UNDEF-terminated list of value(s) of the attribute.
-			If there are more and there is an interpretation of their order
-			they must be sorted, eg. current value of tag is the last one.
-\retval	0 success
-\retval ENOSYS	this attribute is not defined by this type of file
-\retval ENOENT	no value is present 
-*/
-	int	(*attr)(void *fpctx,void *handle,const char *attr,glite_jp_attrval_t **attrval);
-
-/** File type specific operation. 
-\param[in] fpctx	Plugin context.
-\param[in] handle	Handle of the opened file.
-\param[in] oper		Code of the operation, specific for a concrete plugin.
-*/
-	int	(*generic)(void *fpctx,void *handle,int oper,...);
-	
-} glite_jpps_fplug_op_t;
-
-/** Data describing a plugin. */
-typedef struct _glite_jpps_fplug_data_t {
-	void	*fpctx;		/**< Context passed to plugin operations. */
-	char	**uris;		/**< NULL-terminated list of file types (URIs)
-					handled by the plugin. */
-	char	**classes;	/**< The same as uris but filesystem-friendly
-					(can be used to construct file names).*/
-	char	**namespaces;	/**< Which attribute namespaces this plugin handles. */
-
-	glite_jpps_fplug_op_t ops; 	/**< Plugin operations. */
-} glite_jpps_fplug_data_t;
-	
-/** Initialisation function of the plugin. 
-  Called after dlopen(), must be named "init".
-\param[in] ctx		JPPS context
-\param[out] data	filled-in plugin data
-*/
-  
-typedef int (*glite_jpps_fplug_init_t)(
-	glite_jp_context_t ctx,
-	glite_jpps_fplug_data_t *plugin_data
-);
-
-
-
-
-/* XXX: not really public interface follows */
-
-int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv);
-int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t ***plugin_data);
-int glite_jpps_fplug_lookup_byclass(glite_jp_context_t, const char *class,glite_jpps_fplug_data_t ***plugin_data,char **uri);
-
-#endif
diff --git a/org.glite.jp.primary/project/build.number b/org.glite.jp.primary/project/build.number
deleted file mode 100644
index c680c72..0000000
--- a/org.glite.jp.primary/project/build.number
+++ /dev/null
@@ -1 +0,0 @@
-module.build=36
diff --git a/org.glite.jp.primary/project/build.properties b/org.glite.jp.primary/project/build.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/org.glite.jp.primary/project/configure.properties.xml b/org.glite.jp.primary/project/configure.properties.xml
deleted file mode 100644
index 5e1ce29..0000000
--- a/org.glite.jp.primary/project/configure.properties.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-	
-        
-	                                                                        
-		
-			
-				 
-			
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-ares_prefix=${with.ares.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
-			 
-	     
-	 
diff --git a/org.glite.jp.primary/project/properties.xml b/org.glite.jp.primary/project/properties.xml
deleted file mode 100755
index 2149dd4..0000000
--- a/org.glite.jp.primary/project/properties.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-	
-	 
diff --git a/org.glite.jp.primary/project/tar_exclude b/org.glite.jp.primary/project/tar_exclude
deleted file mode 100644
index e1fcd1a..0000000
--- a/org.glite.jp.primary/project/tar_exclude
+++ /dev/null
@@ -1,10 +0,0 @@
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
diff --git a/org.glite.jp.primary/project/version.properties b/org.glite.jp.primary/project/version.properties
deleted file mode 100644
index cd1e9e7..0000000
--- a/org.glite.jp.primary/project/version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-module.version=1.0.0
-module.age=1
diff --git a/org.glite.jp.primary/src/authz.c b/org.glite.jp.primary/src/authz.c
deleted file mode 100644
index 3ceba02..0000000
--- a/org.glite.jp.primary/src/authz.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpps_H.h"
-#include "jptype_map.h"
-
-int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner)
-{
-	glite_jp_error_t	err;
-	char	buf[200];
-	int	i;
-
-	memset(&err,0,sizeof err);
-	glite_jp_clear_error(ctx);
-	err.source = __FUNCTION__;
-	err.code = EPERM;
-	
-	switch (op) {
-		case SOAP_TYPE___jpsrv__RegisterJob:
-		case SOAP_TYPE___jpsrv__StartUpload:
-		case SOAP_TYPE___jpsrv__CommitUpload:
-			for (i=0; ctx->trusted_peers && ctx->trusted_peers[i]; i++) 
-				if (!strcmp(ctx->trusted_peers[i],ctx->peer)) return 0;
-			err.desc = "you are not a trusted peer";
-			return glite_jp_stack_error(ctx,&err);
-
-		case SOAP_TYPE___jpsrv__GetJobFiles:
-		case SOAP_TYPE___jpsrv__GetJobAttributes:
-			assert(owner);
-			return strcmp(owner,ctx->peer) ? glite_jp_stack_error(ctx,&err) : 0;
-			break;
-
-		default:
-			snprintf(buf,sizeof buf,"%d: unknown operation",op);
-			err.desc = buf;
-			err.code = EINVAL;
-			return glite_jp_stack_error(ctx,&err);
-	}
-}
-
-int glite_jpps_readauth(glite_jp_context_t ctx,const char *file)
-{
-	FILE	*f = fopen(file,"r");
-	glite_jp_error_t	err;
-	int	cnt = 0;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	if (!f) {
-		err.code = errno;
-		err.desc = file;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	ctx->trusted_peers = NULL;
-	while (!feof(f)) {
-		char	buf[BUFSIZ];
-
-		if (fscanf(f,"%[^\n]\n",buf) != 1) {
-			err.code = EINVAL;
-			err.desc = file;
-			fclose(f);
-			return glite_jp_stack_error(ctx,&err);
-		}
-
-		ctx->trusted_peers = realloc(ctx->trusted_peers, (cnt+2) * sizeof *ctx->trusted_peers);
-		ctx->trusted_peers[cnt++] = strdup(buf);
-		ctx->trusted_peers[cnt] = NULL;
-	}
-	fclose(f);
-	return 0;
-}
diff --git a/org.glite.jp.primary/src/authz.h b/org.glite.jp.primary/src/authz.h
deleted file mode 100644
index 9451aef..0000000
--- a/org.glite.jp.primary/src/authz.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Check authorisation of JPPS operation on job.
- *
- * \param[in] ctx	JP context including peer name & other credentials (VOMS etc.)
- * \param[in] op	operation, one of SOAP_TYPE___jpsrv__*
- * \param[in] job	jobid of the job to decide upon
- * \param[in] owner	current known owner of the job (may be NULL), shortcut to avoid
- *			unnecessary database query.
- *
- * \retval 0		OK, operation permitted
- * \retval EPERM	denied
- * \retval other	error
- */
-
-int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner);
-
-int glite_jpps_readauth(glite_jp_context_t ctx,const char *file);
-
diff --git a/org.glite.jp.primary/src/backend.h b/org.glite.jp.primary/src/backend.h
deleted file mode 100644
index cf901fb..0000000
--- a/org.glite.jp.primary/src/backend.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef __GLITE_JP_BACKEND
-#define __GLITE_JP_BACKEND
-
-#include 
-#include 
-
-int glite_jppsbe_init(
-	glite_jp_context_t ctx,
-	int argc,
-	char *argv[]
-);
-
-int glite_jppsbe_init_slave(
-	glite_jp_context_t ctx
-);
-
-int glite_jppsbe_register_job(	
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *owner
-);
-
-int glite_jppsbe_start_upload(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,	/* must be filesystem-friendly */
-	const char *name,	/* optional name within the class */
-	const char *content_type,
-	char **destination_out,
-	time_t *commit_before_inout
-);
-
-int glite_jppsbe_commit_upload(
-	glite_jp_context_t ctx,
-	const char *destination
-);
-
-int glite_jppsbe_get_names(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	char	***names_out
-);
-
-int glite_jppsbe_destination_info(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char **job_out,
-	char **class_out,
-	char **name_out
-);
-
-int glite_jppsbe_get_job_url(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* optional within class */
-	char **url_out
-);
-
-int glite_jppsbe_open_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* optional within class */
-	int mode,
-	void **handle_out
-);
-
-int glite_jppsbe_close_file(
-	glite_jp_context_t ctx,
-	void *handle
-);
-
-int glite_jppsbe_pread(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset,
-	ssize_t *nbytes_ret
-);
-
-int glite_jppsbe_pwrite(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset
-);
-
-int glite_jppsbe_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes
-);
-
-int glite_jppsbe_get_job_metadata(
-	glite_jp_context_t ctx,
-	const char *job,
-	glite_jp_attrval_t attrs_inout[]
-);
-
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-);
-
-#endif
diff --git a/org.glite.jp.primary/src/bones_server.c b/org.glite.jp.primary/src/bones_server.c
deleted file mode 100644
index dcc31d6..0000000
--- a/org.glite.jp.primary/src/bones_server.c
+++ /dev/null
@@ -1,333 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "glite/lb/srvbones.h"
-#include "glite/security/glite_gss.h"
-
-#include 
-#include "glite/security/glite_gsplugin.h"
-
-#include "backend.h"
-#include "file_plugin.h"
-
-#include "soap_version.h"
-#include "jpps_H.h"
-
-#define CONN_QUEUE	20
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-
-static int newconn(int,struct timeval *,void *);
-static int request(int,struct timeval *,void *);
-static int reject(int);
-static int disconn(int,struct timeval *,void *);
-static int data_init(void **data);
-
-static struct glite_srvbones_service stab = {
-	"JP Primary Storage", -1, newconn, request, reject, disconn
-};
-
-static time_t cert_mtime;
-static char *server_cert, *server_key, *cadir;
-static gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL;
-static char *mysubj;
-
-static char *port = "8901";
-static int debug = 1;
-
-static glite_jp_context_t	ctx;
-
-static int call_opts(glite_jp_context_t,char *,char *,int (*)(glite_jp_context_t,int,char **));
-
-char *glite_jp_default_namespace;
-
-int main(int argc, char *argv[])
-{
-	int	one = 1,opt,i;
-	edg_wll_GssStatus	gss_code;
-	struct sockaddr_in	a;
-	char	*b_argv[20] = { "backend" },*p_argv[20] = { "plugins" },*com;
-	int	b_argc,p_argc;
-
-	glite_jp_init_context(&ctx);
-
-	b_argc = p_argc = 1;
-
-	while ((opt = getopt(argc,argv,"B:P:a:")) != EOF) switch (opt) {
-		case 'B':
-			assert(b_argc < 20);
-			if (com = strchr(optarg,',')) *com = 0;
-			
-			/* XXX: memleak -- who cares for once */
-			asprintf(&b_argv[b_argc++],"-%s",optarg);
-			if (com) b_argv[b_argc++] = com+1;
-
-			break;
-		case 'P':
-			assert(p_argc < 20);
-			p_argv[p_argc++] = optarg;
-
-			break;
-		case 'a':
-			if (glite_jpps_readauth(ctx,optarg)) {
-				fprintf(stderr,"%s: %s\n",argv[0],glite_jp_error_chain(ctx));
-				exit (1);
-			}
-			break;
-		case '?': fprintf(stderr,"usage: %s: -Bb,val ... -Pplugin.so ...\n"
-					  "b is backend option\n",argv[0]);
-			  exit (1);
-	}
-
-	if (b_argc == 1) {
-		fputs("-B required\n",stderr);
-		exit (1);
-	}
-	
-	optind = 0; /* XXX: getopt used internally */
-	if (glite_jppsbe_init(ctx,b_argc,b_argv)) {
-		fputs(glite_jp_error_chain(ctx), stderr);
-		exit(1);
-	}
-
-	optind = 0; /* XXX: getopt used internally */
-	if (b_argc > 1 && glite_jpps_fplug_load(ctx,p_argc,p_argv)) {
-		fputs(glite_jp_error_chain(ctx), stderr);
-		exit(1);
-	}
-
-	srand48(time(NULL)); /* feed id generation */
-
-#if GSOAP_VERSION <= 20602
-	for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"ns1"); i++);
-#else
-	for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"jpsrv"); i++);
-#endif
-	assert(jpps__namespaces[i].id);
-	glite_jp_default_namespace = jpps__namespaces[i].ns;
-
-	stab.conn = socket(PF_INET, SOCK_STREAM, 0);
-	if (stab.conn < 0) {
-		perror("socket");
-		return 1;
-	}
-
-	setsockopt(stab.conn,SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
-
-	a.sin_family = AF_INET;
-	a.sin_addr.s_addr = INADDR_ANY;
-	a.sin_port = htons(atoi(port));
-	if (bind(stab.conn,(struct sockaddr *) &a, sizeof(a)) ) {
-		char	buf[200];
-
-		snprintf(buf,sizeof(buf),"bind(%d)",atoi(port));
-		perror(buf);
-		return 1;
-	}
-
-	if (listen(stab.conn,CONN_QUEUE)) {
-		perror("listen()");
-		return 1;
-	}
-
-	if (!server_cert || !server_key)
-		fprintf(stderr, "%s: WARNING: key or certificate file not specified, "
-				"can't watch them for changes\n",
-				argv[0]);
-
-	if ( cadir ) setenv("X509_CERT_DIR", cadir, 1);
-	edg_wll_gss_watch_creds(server_cert, &cert_mtime);
-
-	if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &mysubj, &gss_code)) 
-		fprintf(stderr,"Server idenity: %s\n",mysubj);
-	else fputs("WARNING: Running unauthenticated\n",stderr);
-
-	/* XXX: daemonise */
-
-	glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,1);
-	glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug);
-
-	return 0;
-}
-
-static int data_init(void **data)
-{
-	*data = (void *) soap_new();
-
-	printf("[%d] slave started\n",getpid());
-	glite_jppsbe_init_slave(ctx);	/* XXX: global but slave's */
-
-	return 0;
-}
-
-static int newconn(int conn,struct timeval *to,void *data)
-{
-	struct soap	*soap = (struct soap *) data;
-	glite_gsplugin_Context	plugin_ctx;
-
-	gss_cred_id_t		newcred = GSS_C_NO_CREDENTIAL;
-	edg_wll_GssStatus	gss_code;
-	gss_name_t		client_name = GSS_C_NO_NAME;
-	gss_buffer_desc		token = GSS_C_EMPTY_BUFFER;
-	OM_uint32		maj_stat,min_stat;
-
-
-	int	ret = 0;
-
-	soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE);
-	soap_set_namespaces(soap,jpps__namespaces);
-	soap->user = (void *) ctx; /* XXX: one instance per slave */
-
-/* not yet: client to JP index
-	ctx->other_soap = soap_new();
-	soap_init(ctx->other_soap);
-	soap_set_namespaces(ctx->other_soap,jpis__namespaces);
-*/
-
-
-	glite_gsplugin_init_context(&plugin_ctx);
-	plugin_ctx->connection = calloc(1,sizeof *plugin_ctx->connection);
-	soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx);
-
-	switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) {
-		case 0: break;
-		case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key,
-						&newcred,NULL,&gss_code))
-			{
-
-				printf("[%d] reloading credentials\n",getpid()); /* XXX: log */
-				gss_release_cred(&min_stat,&mycred);
-				mycred = newcred;
-			}
-			break;
-		case -1:
-			printf("[%d] edg_wll_gss_watch_creds failed\n", getpid()); /* XXX: log */
-			break;
-	}
-
-	/* TODO: DNS paranoia etc. */
-
-	if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) {
-		printf("[%d] GSS connection accept failed, closing.\n", getpid());
-		ret = 1;
-		goto cleanup;
-	}
-
-	maj_stat = gss_inquire_context(&min_stat,plugin_ctx->connection->context,
-			&client_name, NULL, NULL, NULL, NULL, NULL, NULL);
-
-	if (!GSS_ERROR(maj_stat))
-		maj_stat = gss_display_name(&min_stat,client_name,&token,NULL);
-
-	if (ctx->peer) free(ctx->peer);
-	if (!GSS_ERROR(maj_stat)) {
-		printf("[%d] client DN: %s\n",getpid(),(char *) token.value); /* XXX: log */
-
-		ctx->peer = strdup(token.value);
-		memset(&token, 0, sizeof(token));
-	}
-	else {
-		printf("[%d] annonymous client\n",getpid());
-		ctx->peer = NULL;
-	}
-
-	if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
-	if (token.value) gss_release_buffer(&min_stat, &token);
-
-	return 0;
-
-cleanup:
-	glite_gsplugin_free_context(plugin_ctx);
-	soap_end(soap);
-
-	return ret;
-}
-
-static int request(int conn,struct timeval *to,void *data)
-{
-	struct soap		*soap = data;
-	glite_jp_context_t	ctx = soap->user;
-
-	glite_gsplugin_set_timeout(glite_gsplugin_get_context(soap),to);
-
-	soap->max_keep_alive = 1;	/* XXX: prevent gsoap to close connection */ 
-	soap_begin(soap);
-	if (soap_begin_recv(soap)) {
-		if (soap->error < SOAP_STOP) {
-			soap_send_fault(soap);
-			return EIO;
-		}
-		return ENOTCONN;
-	}
-
-	soap->keep_alive = 1;
-	if (soap_envelope_begin_in(soap)
-		|| soap_recv_header(soap)
-		|| soap_body_begin_in(soap)
-		|| jpps__serve_request(soap)
-#if GSOAP_VERSION >= 20700
-		|| (soap->fserveloop && soap->fserveloop(soap))
-#endif
-	)
-	{
-		soap_send_fault(soap);
-		if (ctx->error) {
-			/* XXX: shall we die on some errors? */
-			int	err = ctx->error->code;
-			glite_jp_clear_error(ctx);
-			return err;
-		}
-		return 0;
-	}
-
-	glite_jp_run_deferred(ctx);
-	return 0;
-}
-
-static int reject(int conn)
-{
-	int	flags = fcntl(conn, F_GETFL, 0);
-
-	fcntl(conn,F_SETFL,flags | O_NONBLOCK);
-	edg_wll_gss_reject(conn);
-
-	return 0;
-}
-
-static int disconn(int conn,struct timeval *to,void *data)
-{
-	struct soap	*soap = (struct soap *) data;
-	soap_end(soap); // clean up everything and close socket
-
-	return 0;
-}
-
-#define WSPACE "\t\n "
-
-static int call_opts(glite_jp_context_t ctx,char *opt,char *name,int (*f)(glite_jp_context_t,int,char **))
-{
-	int	ac = 1,ret,my_optind; 
-	char	**av = malloc(sizeof *av),*ap;
-
-	*av = name;
-	for (ap = strtok(opt,WSPACE); ap; ap = strtok(NULL,WSPACE)) {
-		av = realloc(av,(ac+1) * sizeof *av);
-		av[ac++] = ap;
-	}
-
-	my_optind = optind;
-	optind = 0;
-	ret = f(ctx,ac,av);
-	optind = my_optind;
-	free(av);
-	return ret;
-}
-
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
diff --git a/org.glite.jp.primary/src/builtin_plugins.h b/org.glite.jp.primary/src/builtin_plugins.h
deleted file mode 100644
index 3b2c201..0000000
--- a/org.glite.jp.primary/src/builtin_plugins.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#define GLITE_JP_FILETYPE_TAGS	"urn:org.glite.jp.primary:tags"
-#define GLITE_JP_FILETYPE_LB	"urn:org.glite.jp.primary:lb"
-#define GLITE_JP_FILETYPE_ISB	"urn:org.glite.jp.primary:isb"
-#define GLITE_JP_FILETYPE_OSB	"urn:org.glite.jp.primary:osb"
-
-#define GLITE_JP_FPLUG_TAGS_APPEND	0
diff --git a/org.glite.jp.primary/src/db.h b/org.glite.jp.primary/src/db.h
deleted file mode 100644
index 0b9f730..0000000
--- a/org.glite.jp.primary/src/db.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _DB_H
-#define _DB_H
-
-#ident "$Header$"
-
-#include 
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct _glite_jp_db_stmt_t *glite_jp_db_stmt_t;
-
-int glite_jp_db_connect(
-	glite_jp_context_t,	/* INOUT: */
-	char *		/* IN: connect string user/password@host:database */
-);
-
-void glite_jp_db_close(glite_jp_context_t);
-
-
-/* Parse and execute SQL statement. Returns number of rows selected, created 
- * or affected by update, or -1 on error */
-
-int glite_jp_db_execstmt(
-	glite_jp_context_t,	/* INOUT: */
-	char *,		/* IN: SQL statement */
-	glite_jp_db_stmt_t *	/* OUT: statement handle. Usable for
-					select only */
-);
-
-
-/* Fetch next row of select statement. 
- * All columns are returned as fresh allocated strings 
- *
- * return values:
- * 	>0 - number of fields of the retrieved row
- * 	 0 - no more rows
- * 	-1 - error
- *
- * Errors are stored in context passed to previous glite_jp_db_execstmt() */
-
-int glite_jp_db_fetchrow(
-	glite_jp_db_stmt_t,	/* IN: statement */
-	char **		/* OUT: array of fetched values. 
-			 *      As number of columns is fixed and known,
-			 *      expects allocated array of pointers here */
-);
-
-/* Retrieve column names of a query statement */
-
-int glite_jp_db_querycolumns(
-	glite_jp_db_stmt_t,	/* IN: statement */
-	char **		/* OUT: result set column names. Expects allocated array. */
-);
-
-/* Free the statement structure */
-
-void glite_jp_db_freestmt(
-	glite_jp_db_stmt_t *    /* INOUT: statement */
-);
-
-
-/* convert time_t into database-specific time string 
- * returns pointer to static area that is changed by subsequent calls */
-
-char *glite_jp_db_timetodb(time_t);
-time_t glite_jp_db_dbtotime(char *);
-
-
-/**
- * Check database version.
- */
-int glite_jp_db_dbcheckversion(glite_jp_context_t);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/org.glite.jp.primary/src/feed.c b/org.glite.jp.primary/src/feed.c
deleted file mode 100644
index 1c80a8e..0000000
--- a/org.glite.jp.primary/src/feed.c
+++ /dev/null
@@ -1,336 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/strmd5.h"
-#include "feed.h"
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-#include "is_client.h"
-
-/* 
- * seconds before feed expires: should be 
- * XXX: should be configurable, default for real deployment sort of 1 hour
- */
-#define FEED_TTL	120
-
-static int check_qry_item(
-		glite_jp_context_t ctx,
-		const glite_jp_query_rec_t    *qry,
-		const glite_jp_attrval_t *attr
-)
-{
-	int	cmp,cmp2;
-	long	scmp,ucmp;
-
-	if (strcmp(qry->attr,attr->name)) return 0;
-
-	if (qry->origin && qry->origin != attr->origin) return 0;
-
-	/* FIXME: fallback only, loop over type plugins and use plugin compare function */
-	cmp = strcmp(attr->value,qry->value);
-
-	switch (qry->op) {
-		case GLITE_JP_QUERYOP_EQUAL: return !cmp;
-		case GLITE_JP_QUERYOP_UNEQUAL: return cmp;
-		case GLITE_JP_QUERYOP_LESS: return cmp < 0;
-		case GLITE_JP_QUERYOP_GREATER: return cmp > 0;
-
-		case GLITE_JP_QUERYOP_WITHIN:
-			/* FIXME: the same */
-			cmp2 = strcmp(attr->value,qry->value);
-			return cmp >= 0 && cmp2 <= 0;
-	}
-}
-
-/* XXX: limit on query size -- I'm lazy to malloc() */
-#define QUERY_MAX	100
-
-static int match_feed(
-		glite_jp_context_t ctx,
-		const struct jpfeed *feed,
-		const char *job,
-
-/* XXX: not checked for correctness,
-	assuming single occurence only */
-		const glite_jp_attrval_t attrs[] 
-)
-{
-	int	i;
-	int	qi[QUERY_MAX];
-
-	glite_jp_attrval_t *newattr = NULL;
-
-	glite_jp_clear_error(ctx);
-
-	if (feed->qry) {
-		int	j,complete = 1;
-
-		memset(qi,0,sizeof qi);
-		for (i=0; feed->qry[i].attr; i++) {
-			int	sat = 0;
-			assert(iqry[i].attr)) {
-					if (check_qry_item(ctx,feed->qry+i,attrs+j)) { 
-						qi[i] = 1;
-						sat = 1; /* matched, needn't loop further */
-					}
-					else return 0; 	/* can't be satisfied either */
-				}
-
-			if (!sat) complete = 0;
-		}
-
-		/* not all attributes in query are known from input 
-		 * we have to retrieve job metadata from the backend
-		 * 
-		 * XXX: It is not optimal to retrieve it here without sharing
-		 * over multiple invocations of match_feed() for the same job.
-		 */
-		if (!complete) {
-			glite_jp_attrval_t	meta[QUERY_MAX+1];
-			int	qi2[QUERY_MAX];
-
-			memset(meta,0,sizeof meta);
-			j=0;
-			for (i=0; feed->qry[i].attr; i++) if (!qi[i]) {
-				assert(jqry[i].attr;
-				qi2[j] = i;
-				j++;
-			}
-
-			if (glite_jppsbe_get_job_metadata(ctx,job,meta)) {
-				glite_jp_error_t	err;
-				memset(&err,0,sizeof err);
-				err.code = EIO;
-				err.source = __FUNCTION__;
-				err.desc = "complete query";
-				return glite_jp_stack_error(ctx,&err);
-			}
-
-			for (i=0; meta[i].name; i++)
-				if (!check_qry_item(ctx,feed->qry+qi2[i],meta+i))
-					return 0;
-		}
-	}
-
-	/* matched completely */
-	return glite_jpps_single_feed(ctx,feed->destination,job,attrs);
-	return 0;
-}
-
-int glite_jpps_match_attr(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t attrs[]
-)
-{
-	struct jpfeed	*f = (struct jpfeed *) ctx->feeds;
-	int	i,j,doit;
-
-	for (;f; f = f->next) {
-		doit = 0;
-
-		for (i=0; !doit && f->attrs[i]; i++) 
-			for (j=0; !doit && attrs[j].name; j++)
-				if (!strcmp(f->attrs[i],attrs[j].name)) doit = 1;
-
-		/* XXX: ignore any errors */
-		if (doit) match_feed(ctx,f,job,attrs);
-	}
-
-	return glite_jp_clear_error(ctx);
-}
-
-static int attr_void_cmp(const void *a, const void *b)
-{
-	char const * const *ca = (char const * const *) a;
-	char const * const *cb = (char const * const *) b;
-	return strcmp(*ca,*cb);
-}
-
-static void attr_union(char **a, char **b, char ***c)
-{
-	int	ca = 0,cb = 0,cnt,i,j;
-	char	**out;
-
-	if (a) for (ca = 0; a[ca]; ca++);
-	if (b) for (cb = 0; b[cb]; cb++);
-	out = malloc((ca+cb+1) * sizeof *out);
-	if (a) memcpy(out,a,ca * sizeof *out);
-	if (b) memcpy(out+ca,b,cb * sizeof *out);
-	out[cnt = ca+cb] = NULL;
-	qsort(out,cnt,sizeof *out,attr_void_cmp);
-
-	for (i=0; i i+1) memmove(out+i+1,out+j,(cnt-j) * sizeof *out);
-		cnt -= j-i-1;
-	}
-
-	*c = out;
-}
-
-int glite_jpps_match_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name
-)
-{
-	glite_jpps_fplug_data_t	**pd = NULL;
-	int	pi;
-	void	*bh = NULL;
-	int	ret;
-	struct	jpfeed	*f = ctx->feeds;
-
-	int	nvals = 0,j,i;
-	char		**attrs = NULL, **attrs2;
-	glite_jp_attrval_t	*vals = NULL,*oneval;
-
-	fprintf(stderr,"%s: %s %s %s\n",__FUNCTION__,job,class,name);
-
-	
-	switch (glite_jpps_fplug_lookup(ctx,class,&pd)) {
-		case ENOENT: return 0;	/* XXX: shall we complain? */
-		case 0: break;
-		default: return -1;
-	}
-
-	for (;f;f=f->next) {
-		attr_union(attrs,f->attrs,&attrs2);
-		free(attrs);
-		attrs = attrs2;
-	}
-
-	for (pi=0; pd[pi]; pi++) {
-		int	ci;
-		for (ci=0; pd[pi]->uris[ci]; ci++) if (!strcmp(pd[pi]->uris[ci],class)) {
-			void	*ph;
-
-			if (!bh && (ret = glite_jppsbe_open_file(ctx,job,pd[pi]->classes[ci],name,O_RDONLY,&bh))) {
-				free(pd);
-				return ret;
-			}
-
-			if (pd[pi]->ops.open(pd[pi]->fpctx,bh,class,&ph)) {
-				/* XXX: complain more visibly */
-				fputs("plugin open failed\n",stderr);
-				continue;
-			}
-
-			for (i=0; attrs[i]; i++) 
-				if (!pd[pi]->ops.attr(pd[pi]->fpctx,ph,attrs[i],&oneval)) {
-				/* XXX: ignore error */
-					for (j=0; oneval[j].name; j++);
-					vals = realloc(vals,(nvals+j+1) * sizeof *vals);
-					memcpy(vals+nvals,oneval,(j+1) * sizeof *vals);
-					nvals += j;
-					free(oneval);
-				}
-
-			pd[pi]->ops.close(pd[pi]->fpctx,ph);
-		}
-	}
-
-	free(attrs);
-
-	for (f = ctx->feeds; f; f=f->next) {
-		int 	k;
-		glite_jp_attrval_t	* fattr = malloc((nvals+1) * sizeof *fattr);
-
-		j = 0;
-		for (i=0; iattrs[k]; k++)
-			if (!strcmp(f->attrs[k],vals[i].name))
-				memcpy(fattr+j++,vals+i,sizeof *fattr);
-
-		memset(fattr+j,0,sizeof *fattr);
-		glite_jpps_single_feed(ctx,f->destination,job,fattr);
-		free(fattr);
-	}
-
-	for (i=0; vals[i].name; i++) glite_jp_attrval_free(vals+i,0);
-	free(vals);
-
-	if (bh) glite_jppsbe_close_file(ctx,bh);
-	free(pd);
-
-	return 0;
-}
-
-static char *generate_feedid(void)
-{
-	char	hname[200],buf[1000];
-
-	gethostname(hname,sizeof hname);
-	snprintf(buf,sizeof buf,"%s%d%ld",hname,getpid(),lrand48());
-	buf[sizeof buf-1] = 0;
-	return str2md5base64(buf);
-}
-
-
-int glite_jpps_run_feed(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char const * const *attrs,
-	const glite_jp_query_rec_t *qry,
-	char **feed_id)
-{
-	fprintf(stderr,"%s: \n",__FUNCTION__);
-	return 0;
-}
-
-static int register_feed_deferred(glite_jp_context_t ctx,void *feed)
-{
-	struct jpfeed	*f = feed;
-
-	f->next = ctx->feeds;
-	ctx->feeds = f;
-	return 0;
-}
-
-/* FIXME:
- * - volatile implementation: should store the registrations in a file
- *   and recover after restart
- * - should communicate the data among all server slaves
- */
-int glite_jpps_register_feed(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char const *const *attrs,
-	const glite_jp_query_rec_t *qry,
-	char **feed_id,
-	time_t *expires)
-{
-	int	i;
-	struct jpfeed	*f = calloc(1,sizeof *f);
-
-	if (!*feed_id) *feed_id = generate_feedid();
-	time(expires); *expires += FEED_TTL;
-
-	f->id = strdup(*feed_id);
-	f->destination = strdup(destination);
-	f->expires = *expires;
-	for (i=0; attrs[i]; i++) {
-		f->attrs = realloc(f->attrs,(i+2) * sizeof *f->attrs);
-		f->attrs[i] = strdup(attrs[i]);
-		f->attrs[i+1] = NULL;
-	}
-	for (i=0; qry[i].attr; i++) {
-		f->qry = realloc(f->qry,(i+2) * sizeof *f->qry);
-		glite_jp_queryrec_copy(f->qry+i,qry+i);
-		memset(f->qry+i+1,0,sizeof *f->qry);
-	}
-
-	glite_jp_add_deferred(ctx,register_feed_deferred,f);
-
-	return 0;
-}
-
diff --git a/org.glite.jp.primary/src/feed.h b/org.glite.jp.primary/src/feed.h
deleted file mode 100644
index d141c5b..0000000
--- a/org.glite.jp.primary/src/feed.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __GLITE_JP_FEED
-#define __GLITE_JP_FEED
-
-
-struct jpfeed {
-	char	*id,*destination;
-	time_t	expires;
-	char	**attrs;
-	glite_jp_query_rec_t	*qry;
-	struct jpfeed	*next;
-};
-
-
-int glite_jpps_match_attr(glite_jp_context_t,const char *,const glite_jp_attrval_t[]);
-int glite_jpps_match_file(glite_jp_context_t,const char *,const char *,const char *);
-int glite_jpps_match_tag(glite_jp_context_t,const char *,const char *,const char *);
-int glite_jpps_run_feed(glite_jp_context_t,const char *,char const * const *,const glite_jp_query_rec_t *,char **);
-int glite_jpps_register_feed(glite_jp_context_t,const char *,char const * const *,const glite_jp_query_rec_t *,char **,time_t *);
-
-#endif
-
diff --git a/org.glite.jp.primary/src/file_plugin.c b/org.glite.jp.primary/src/file_plugin.c
deleted file mode 100644
index 144a231..0000000
--- a/org.glite.jp.primary/src/file_plugin.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include "file_plugin.h"
-
-static struct option opts[] = {
-	{ "plugin", 1, NULL, 'p' },
-	{ NULL }
-};
-
-static int loadit(glite_jp_context_t ctx,const char *so)
-{
-/* XXX: not stored but we never dlclose() yet */
-	void	*dl_handle = dlopen(so,RTLD_NOW);
-
-	glite_jp_error_t	err;
-	const char	*e;
-	glite_jpps_fplug_data_t	*data,*dp;
-	int	i;
-
-	glite_jpps_fplug_init_t	init;
-	memset(&err,0,sizeof err);
-
-	if (!dl_handle) {
-		err.source = "dlopen()";
-		err.code = EINVAL;
-		err.desc = dlerror();
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	dlerror();
-	init = dlsym(dl_handle,"init");
-	e = dlerror();
-	if (e) {
-		char	buf[300];
-		snprintf(buf,sizeof buf,"dlsym(\"%s\",\"init\")",so);
-		buf[299] = 0;
-		err.source = buf;
-		err.code = ENOENT;
-		err.desc = e;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	data = calloc(1,sizeof *data);
-
-	if (init(ctx,data)) return -1;
-
-	i = 0;
-	if (ctx->plugins) for (i=0; ctx->plugins[i]; i++);
-	ctx->plugins = realloc(ctx->plugins, (i+2) * sizeof *ctx->plugins);
-	ctx->plugins[i] = data;
-	ctx->plugins[i+1] = NULL;
-
-	/* TODO: check consistency of uri+class pairs wrt. previous plugins */
-	
-	return 0;
-}
-
-int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv)
-{
-	int	i;
-
-	for (i=1; iplugins) {
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	for (i = 0; ctx->plugins[i]; i++) {
-		int	j;
-		glite_jpps_fplug_data_t	*p = ctx->plugins[i];
-
-		for (j=0; p->uris && p->uris[j]; j++)
-			if (!strcmp(p->uris[j],uri)) {
-				out = realloc(out, (matches+2) * sizeof *out);
-				out[matches++] = p;
-				out[matches] = NULL;
-			}
-	}
-
-	if (matches) {
-		*plugin_data = out;
-		return 0;
-	}
-	else return glite_jp_stack_error(ctx,&err);
-}
-
diff --git a/org.glite.jp.primary/src/ftp_backend.c b/org.glite.jp.primary/src/ftp_backend.c
deleted file mode 100644
index 8bf523b..0000000
--- a/org.glite.jp.primary/src/ftp_backend.c
+++ /dev/null
@@ -1,1744 +0,0 @@
-#ident "$Header$"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-
-#include "tags.h"
-#include "backend.h"
-
-#define UPLOAD_SUFFIX ".upload"
-#define LOCK_SUFFIX ".lock"
-
-struct ftpbe_config {
-	char *internal_path;
-	char *external_path;
-	char *gridmap;
-	char *logname;
-};
-
-static struct ftpbe_config *config = NULL;
-
-struct fhandle_rec {
-	int fd;
-	int fd_append;
-};
-typedef struct fhandle_rec *fhandle;
-
-static struct option ftpbe_opts[] = {
-	{ "ftp-internal-path", 1, NULL, 'I' },
-	{ "ftp-external-path", 1, NULL,	'E' },
-	{ "ftp-gridmap",       1, NULL,	'G' },
-	{ NULL,                0, NULL,  0  }
-};
-
-/* obsolete */
-#if 0
-static struct {
-	glite_jp_fileclass_t	type;
-	char *			fname;
-	} class_to_fname_tab[] = {
-		{ GLITE_JP_FILECLASS_INPUT,  "input" },
-		{ GLITE_JP_FILECLASS_OUTPUT, "output" },
-		{ GLITE_JP_FILECLASS_LBLOG,  "lblog" },
-		{ GLITE_JP_FILECLASS_TAGS,   "tags" },
-		{ GLITE_JP_FILECLASS_UNDEF,  NULL }
-	};
-
-static char *class_to_fname(glite_jp_fileclass_t type)
-{
-	int i;
-
-	for (i = 0; class_to_fname_tab[i].type != GLITE_JP_FILECLASS_UNDEF; i++)
-		if (type == class_to_fname_tab[i].type)
-			return class_to_fname_tab[i].fname;
-
-	return NULL;
-}
-
-static glite_jp_fileclass_t fname_to_class(char* fname)
-{
-	int i;
-
-	for (i = 0; class_to_fname_tab[i].type != GLITE_JP_FILECLASS_UNDEF; i++)
-		if (!strcmp(fname, class_to_fname_tab[i].fname))
-			return class_to_fname_tab[i].type;
-
-	return GLITE_JP_FILECLASS_UNDEF;
-}
-#endif
-
-static int config_check(
-	glite_jp_context_t ctx,
-	struct ftpbe_config *config)
-{
-	return config == NULL ||
-		config->internal_path == NULL ||
-		config->external_path == NULL ||
-		config->gridmap == NULL ||
-		config->logname == NULL;
-
-	/* XXX check reality */
-}
-
-static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job, 
-			  char **unique, char **ju_path, int get_path)
-{
-	char *p;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	p = strrchr(job, '/');
-	if (!p) {
-		err.code = EINVAL;
-		err.desc = "Malformed jobid";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	/* XXX thorough checks */
-	if (!(*unique = strdup(p+1))) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (get_path) {
-		if (!(*ju_path = strdup(p+1))) {
-			free(*unique);
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		*(*ju_path + 10) = '\0';
-	}
-	return 0;
-}
-
-static int mkdirpath(const char* path, int prefixlen)
-{
-	char *wpath, *p;
-	int goout, ret;
-
-	wpath = strdup(path);
-	if (!wpath) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	p = wpath + prefixlen;
-	goout = 0;
-	while (!goout) {
-		while (*p == '/') p++;
-		while (*p != '/' && *p != '\0') p++;
-		goout = (*p == '\0');
-		*p = '\0';
-		ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR);
-		if (ret < 0 && errno != EEXIST) break;
-		*p = '/';
-	}
-	free(wpath);
-	return goout ? 0 : ret;
-}
-
-static long regtime_trunc(long tv_sec)
-{
-	return tv_sec / (86400*7);
-}
-
-static long regtime_ceil(long tv_sec)
-{
-	return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ;
-}
-
-/********************************************************************************/
-int glite_jppsbe_init(
-	glite_jp_context_t ctx,
-	int argc,
-	char *argv[]
-)
-{
-	glite_jp_error_t err;
-	int opt;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	config = (struct ftpbe_config *) calloc(1, sizeof *config);
-	if (!config) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	config->logname = getlogin();
-
-	while ((opt = getopt_long(argc, argv, "I:E:G:", ftpbe_opts, NULL)) != EOF) {
-		switch (opt) {
-			case 'I': config->internal_path = optarg; break;
-			case 'E': config->external_path = optarg; break;
-			case 'G': config->gridmap = optarg; break;
-			default: break;
-		}
-	}
-
-	if (config_check(ctx, config)) {
-		err.code = EINVAL;
-		err.desc = "Invalid FTP backend configuration";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_init_slave(
-	glite_jp_context_t ctx
-)
-{
-	/* Nothing to do */
-}
-
-int glite_jppsbe_register_job(	
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *owner
-)
-{
-	glite_jp_error_t err;
-	char *int_dir = NULL;
-	char *int_fname = NULL;
-	char *data_dir = NULL;
-	char *data_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *ownerhash = NULL;
-	FILE *regfile = NULL;
-	struct timeval reg_tv;
-	long reg_tv_trunc;
-	struct stat statbuf;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job != NULL);
-	assert(owner != NULL);
-
-	gettimeofday(®_tv, NULL);
-	reg_tv_trunc = regtime_trunc(reg_tv.tv_sec);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_dir, "%s/regs/%s",
-			config->internal_path, ju_path) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (mkdirpath(int_dir, strlen(config->internal_path)) < 0 &&
-			errno != EEXIST) {
-		free(int_dir);
-		err.code = errno;
-		err.desc = "Cannot mkdir jobs's reg directory";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	free(int_dir);
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (stat(int_fname, &statbuf) < 0) {
-		if (errno != ENOENT) {
-			err.code = errno;
-			err.desc = "Cannot stat jobs's reg info file";
-			goto error_out;
-		}
-	} else {
-		err.code = EEXIST;
-		err.desc = "Job already registered";
-		goto error_out;
-	}
-
-	regfile = fopen(int_fname, "w");
-	if (regfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-
-	ownerhash = str2md5(owner); /* static buffer */
-	
-	if (fprintf(regfile, "%d %ld.%06ld %s %s %d %s\n", 1,
-		(long)reg_tv.tv_sec, (long)reg_tv.tv_usec, job,
-		ownerhash, strlen(owner), owner) < 1 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot write jobs's reg info file";
-		goto error_out;
-	}
-	if (fclose(regfile) != 0 ) {
-		err.code = errno;
-		err.desc = "Cannot close(write) jobs's reg info file";
-		goto error_out;
-	}
-
-	if (asprintf(&data_dir, "%s/data/%s/%d/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (asprintf(&data_fname, "%s/_info", data_dir) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 &&
-			errno != EEXIST) {
-		err.code = errno;
-		err.desc = "Cannot mkdir jobs's data directory";
-		goto error_out;
-	}
-
-	if (link(int_fname, data_fname) < 0) {
-		err.code = errno;
-		err.desc = "Cannot link job's reg and data info files";
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(data_fname);
-	if (err.code && data_dir) rmdir(data_dir);
-	free(data_dir);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int add_to_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	gridmap = fopen(config->gridmap, "a");
-	if (!gridmap) {
-		err.code = errno;
-		err.desc = "Cannot open gridmap file";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 ||
-		ferror(gridmap)) {
-		err.code = EIO;
-		err.desc = "Cannot write to gridmap file";
-		fclose(gridmap);
-		return glite_jp_stack_error(ctx,&err);
-	}
-	fclose(gridmap);
-	return 0;
-}
-
-static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	char *temp_name = NULL;
-	FILE *temp_file = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	/* XXX */
-	return 0;
-}
-
-int glite_jppsbe_start_upload(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	/* TODO */
-	const char *content_type,
-	char **destination_out,
-	time_t *commit_before_inout
-)
-{
-	char *int_fname = NULL;
-	char *lock_fname = NULL;
-	FILE *lockfile = NULL;
-	FILE *regfile = NULL;
-	char *data_dir = NULL;
-	char *data_lock = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *peername = NULL;
-	int info_version;
-	long reg_time;
-	char ownerhash[33];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(destination_out!=NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	peername = glite_jp_peer_name(ctx);
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%*ld %*s %s ", &info_version,
-		®_time, ownerhash) < 3 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	fclose(regfile);
-
-	/* XXX authorization */
-
-	if (asprintf(&data_dir, "%s/data/%s/%d/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_time), ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(&lock_fname, "%s/%s" LOCK_SUFFIX,
-			data_dir, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (commit_before_inout != NULL)
-		*commit_before_inout = (time_t) LONG_MAX;  /* XXX no timeout enforced */
-
-	lockfile = fopen(lock_fname, "w");
-	if (lockfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open uploads's lock file";
-		goto error_out;
-	}
-
-	if (fprintf(lockfile, "%ld %d %s\n", (long)*commit_before_inout,
-		peername ? peername : 0,
-		peername ? peername : "") < 1 || ferror(regfile)) {
-		fclose(lockfile);
-		err.code = errno;
-		err.desc = "Cannot write upload's lock file";
-		goto error_out;
-	}
-	if (fclose(lockfile) != 0 ) {
-		err.code = errno;
-		err.desc = "Cannot close(write) upload's lock file";
-		goto error_out;
-	}
-
-	if (asprintf(destination_out, "%s/data/%s/%d/%s/%s" UPLOAD_SUFFIX,
-			config->external_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (add_to_gridmap(ctx, peername)) {
-		err.code = EIO;
-		err.desc = "Cannot add peer DN to ftp server authorization file";
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(data_dir);
-	if (err.code && data_lock) unlink(data_lock);
-	free(data_lock);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_commit_upload(
-	glite_jp_context_t ctx,
-	const char *destination
-)
-{
-	size_t dest_len;
-	size_t suff_len;
-	size_t extp_len;
-	long commit_before;
-	int lockpeerlen;
-	char *lockpeername = NULL;
-	char *peername = NULL;
-	char *dest_rw = NULL;
-	char *dest_rw_suff = NULL;
-	char *dest_rw_lock = NULL;
-	FILE *lockfile = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(destination != NULL);
-
-	suff_len = strlen(UPLOAD_SUFFIX);
-	dest_len = strlen(destination);
-	extp_len = strlen(config->external_path);
-
-	if (dest_len < suff_len ||
-		strcmp(UPLOAD_SUFFIX, destination + (dest_len - suff_len)) ||
-		strncmp(destination, config->external_path, extp_len)) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&dest_rw_suff, "%s%s", config->internal_path,
-		destination + extp_len) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	dest_rw = strdup(dest_rw_suff);
-	if (!dest_rw) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	*(dest_rw + (strlen(dest_rw_suff) - suff_len)) = '\0';
-
-	if (asprintf(&dest_rw_lock, "%s" LOCK_SUFFIX, dest_rw) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	lockfile = fopen(dest_rw_lock, "r");
-	if (lockfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open upload's lock file";
-		goto error_out;
-	}
-	if (fscanf(lockfile, "%ld %d ", &commit_before, &lockpeerlen) < 2 || ferror(lockfile)) {
-		fclose(lockfile);
-		err.code = errno;
-		err.desc = "Cannot read upload's lock file";
-		goto error_out;
-	}
-	if (lockpeerlen) {
-		lockpeername = (char*) calloc(1, lockpeerlen+1);
-		if (!lockpeername) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(lockpeername, lockpeerlen+1, lockfile) == NULL) {
-			fclose(lockfile);
-			err.code = errno;
-			err.desc = "Cannot read upload's lock file";
-			goto error_out;
-		}
-	}
-	fclose(lockfile);
-
-	peername = glite_jp_peer_name(ctx);
-	if (lockpeername && (!peername || strcmp(lockpeername, peername))) {
-		err.code = EPERM;
-		err.desc = "Upload started by client of different identity";
-		goto error_out;
-	}
-
-	if (rename(dest_rw_suff, dest_rw) < 0) {
-		err.code = errno;
-		err.desc = "Cannot move upload file to the final place";
-		goto error_out;
-	}
-
-	if (unlink(dest_rw_lock) < 0) {
-		err.code = errno;
-		err.desc = "Cannot unlink upload's lock file";
-		goto error_out;
-	}
-
-error_out:
-	free(dest_rw);
-	free(dest_rw_suff);
-	free(dest_rw_lock);
-	free(peername);
-	free(lockpeername);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_destination_info(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char **job,
-	char **class,
-	char **name
-)
-{
-	size_t dest_len;
-	size_t suff_len;
-	size_t extp_len;
-	char *dest_rw = NULL;
-	char *dest_rw_suff = NULL;
-	char *dest_rw_info = NULL;
-	FILE *infofile = NULL;
-	char *classname = NULL;
-	char jobstr[256+1];
-	glite_jp_error_t err;
-
-	assert(destination != NULL);
-	assert(job != NULL);
-	assert(class != NULL);
-	assert(name != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	suff_len = strlen(UPLOAD_SUFFIX);
-	dest_len = strlen(destination);
-	extp_len = strlen(config->external_path);
-
-	if (dest_len < suff_len ||
-		strcmp(UPLOAD_SUFFIX, destination + (dest_len - suff_len)) ||
-		strncmp(destination, config->external_path, extp_len)) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&dest_rw_suff, "%s%s", config->internal_path,
-		destination + extp_len) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	dest_rw = strdup(dest_rw_suff);
-	if (!dest_rw) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	*(dest_rw + (strlen(dest_rw_suff) - suff_len)) = '\0';
-
-	classname = strrchr(dest_rw,'/');
-	if (classname == NULL) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		goto error_out;
-	}
-	*classname++ ='\0';
-	*class = strdup(classname);
-
-/* XXX: do we need similar check? 
-	if (!class == GLITE_JP_FILECLASS_UNDEF) {
-		err.code = EINVAL;
-		err.desc = "Forged destination path";
-		goto error_out;
-	}
-*/
-
-	/* TODO: */
-	*name = NULL;
-
-	if (asprintf(&dest_rw_info, "%s/_info", dest_rw) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	infofile = fopen(dest_rw_info, "r");
-	if (infofile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open _info file";
-		goto error_out;
-	}
-	if (fscanf(infofile, "%*d %*ld.%*ld %256s ", jobstr) < 1 || ferror(infofile)) {
-		fclose(infofile);
-		err.code = errno;
-		err.desc = "Cannot read _info file";
-		goto error_out;
-	}
-	*job = strdup(jobstr);
-	fclose(infofile);
-
-error_out:
-	free(dest_rw);
-	free(dest_rw_suff);
-	free(dest_rw_info);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-
-int glite_jppsbe_get_job_url(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	/* TODO */
-	char **url_out
-)
-{
-	FILE *regfile = NULL;
-	char *int_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	int info_version;
-	long reg_time;
-	char ownerhash[33];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(url_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%*ld %*s %s", &info_version,
-		®_time, ownerhash) < 3 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	fclose(regfile);
-
-	if (asprintf(url_out, "%s/data/%s/%d/%s/%s",
-			config->external_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int get_job_fname(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* TODO */
-	char **fname_out
-)
-{
-	FILE *regfile = NULL;
-	char *int_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	int info_version;
-	long reg_time;
-	char ownerhash[33];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(fname_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%*ld %*s %s", &info_version,
-		®_time, ownerhash) < 3 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	fclose(regfile);
-
-	if (asprintf(fname_out, "%s/data/%s/%d/%s/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	free(int_fname);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_open_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,	/* TODO */
-	int mode,
-	void **handle_out
-)
-{
-	fhandle	handle = NULL;
-	char* fname = NULL;
-	glite_jp_error_t err;
-
-	assert(handle_out != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (get_job_fname(ctx, job, class, name, &fname)) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot construct internal filename";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	handle = (fhandle) calloc(1,sizeof(*handle));
-	if (handle == NULL) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	handle->fd = open(fname, mode, S_IRUSR | S_IWUSR);
-	if (handle->fd < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file";
-		free(handle);
-		goto error_out;
-	}
-	handle->fd_append = open(fname, mode | O_APPEND, S_IRUSR | S_IWUSR);
-	if (handle->fd_append < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file for append";
-		close(handle->fd);
-		free(handle);
-		goto error_out;
-	}
-	*handle_out = (void*) handle;
-
-error_out:
-	free(fname);
-	if (err.code) { 
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_close_file(
-	glite_jp_context_t ctx,
-	void *handle
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (close(((fhandle)handle)->fd_append) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor (fd_append)";
-		goto error_out;
-	}
-	if (close(((fhandle)handle)->fd) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor";
-		goto error_out;
-	}
-
-error_out:
-	free(handle);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_pread(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset,
-	ssize_t *nbytes_ret
-)
-{
-	ssize_t ret;
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if ((ret = pread(((fhandle)handle)->fd, buf, nbytes, offset)) < 0) {
-		err.code = errno;
-		err.desc = "Error in pread()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	*nbytes_ret = ret;
-
-	return 0;
-}
-
-int glite_jppsbe_pwrite(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (pwrite(((fhandle)handle)->fd, buf, nbytes, offset) < 0) {
-		err.code = errno;
-		err.desc = "Error in pwrite()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (write(((fhandle)handle)->fd_append, buf, nbytes) < 0) {
-		err.code = errno;
-		err.desc = "Error in write()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-static int get_job_info(
-	glite_jp_context_t ctx,
-	const char *job,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	char *ju = NULL;
-	char *ju_path = NULL;
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char *int_fname = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %*s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, &ownerlen) < 4 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	free(int_fname);
-	free(ju);
-	free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-static int get_job_info_int(
-	glite_jp_context_t ctx,
-	const char *int_fname,
-	char **jobid,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char jobid_buf[256];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, jobid_buf, &ownerlen) < 5 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	*jobid = strdup(jobid_buf);
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_get_job_metadata(
-	glite_jp_context_t ctx,
-	const char *job,
-	glite_jp_attrval_t attrs_inout[]
-)
-{
-	int got_info = 0;
-	struct timeval tv_reg;
-	char *owner = NULL;
-	int got_tags = 0;
-	void *tags_handle = NULL;
-	glite_jp_tagval_t* tags = NULL;
-	int i,j;
-	glite_jp_error_t err;
-
-	assert(job != NULL);
-	assert(attrs_inout != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; attrs_inout[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (attrs_inout[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TIME:
-*/
-			if (!got_info) {
-				if (get_job_info(ctx, job, &owner, &tv_reg)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot retrieve job info";
-					goto error_out;
-				}
-				got_info = 1;
-			}
-			break;
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			if (!got_tags) {
-				if (glite_jppsbe_open_file(ctx, job, GLITE_JP_FILECLASS_TAGS,
-					O_RDONLY, &tags_handle)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot open tag file";
-					goto error_out;
-				}
-				if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot read tags";
-					glite_jppsbe_close_file(ctx, tags_handle);
-					goto error_out;
-				}
-				glite_jppsbe_close_file(ctx, tags_handle);
-				got_tags = 1;
-			}
-			break;
-*/
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type";
-			goto error_out;
-			break;
-		}
-
-		switch (attrs_inout[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-			attrs_inout[i].value.s = strdup(owner);
-			if (!attrs_inout[i].value.s) {
-				err.code = ENOMEM;
-				err.desc = "Cannot copy owner string";
-				goto error_out;
-			}	
-			break;
-		case GLITE_JP_ATTR_TIME:
-			attrs_inout[i].value.time = tv_reg;
-			break;
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			for (j = 0; tags[j].name != NULL; j++) {
-				if (!strcmp(tags[j].name, attrs_inout[i].attr.name)) {
-					if (glite_jpps_tagval_copy(ctx, &tags[j],
-						&attrs_inout[i].value.tag)) {
-						err.code = ENOMEM;
-						err.desc = "Cannot copy tag value";
-						goto error_out;
-					}
-					break;
-				}
-			}
-			if (!tags[j].name) attrs_inout[i].value.tag.name = NULL;
-			break;
-*/
-		default:
-			break;
-		}
-	}
-
-error_out:
-	free(owner);
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	free(tags);
-	
-	if (err.code) {
-		while (i > 0) {
-			i--;
-			switch (attrs_inout[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				free(attrs_inout[i].value.s);
-				break;
-			case GLITE_JP_ATTR_TAG:
-				free(attrs_inout[i].value.tag.name);
-				free(attrs_inout[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-static int compare_timeval(struct timeval a, struct timeval b)
-{
-	if (a.tv_sec < b.tv_sec) return -1;
-	if (a.tv_sec > b.tv_sec) return 1;
-	if (a.tv_usec < b.tv_usec) return -1;
-	if (a.tv_usec > b.tv_usec) return 1;
-	return 0;
-}
-
-
-/* FIXME: disabled -- clarification wrt. filetype plugin needed */
-
-#if 0
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-);
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	char *time_dirname = NULL;
-	DIR *time_dirp = NULL;
-	struct dirent *jobent;
-	char *info_fname = NULL;
-	char *jobid = NULL;
-	char *owner = NULL;
-	struct timeval tv_reg;
-	void *tags_handle = NULL;
-	int matching;
-	int i, j;
-	glite_jp_tagval_t* tags = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (asprintf(&time_dirname, "%s/data/%s/%d", config->internal_path,
-			ownerhash, regtime_tr) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	time_dirp = opendir(time_dirname);
-	if (!time_dirp) {
-		free(time_dirname);
-		return 0; /* found nothing */
-	}
-	while ((jobent = readdir(time_dirp)) != NULL) {
-		if (!strcmp(jobent->d_name, ".")) continue;
-		if (!strcmp(jobent->d_name, "..")) continue;
-		if (asprintf(&info_fname, "%s/%s/_info", time_dirname,
-				jobent->d_name) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (get_job_info_int(ctx, info_fname, &jobid, &owner,  &tv_reg)) {
-			err.code = EIO;
-			err.desc = "Cannot retrieve job info";
-			goto error_out;
-		}
-		if (q_tags || md_tags) {
-			if (glite_jppsbe_open_file(ctx, jobid, GLITE_JP_FILECLASS_TAGS,
-				O_RDONLY, &tags_handle)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot open tag file";
-				goto error_out;
-			}
-			if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot read tags";
-				glite_jppsbe_close_file(ctx, tags_handle);
-				goto error_out;
-			}
-			glite_jppsbe_close_file(ctx, tags_handle);
-			tags_handle = NULL;
-		}
-
-		matching = 1;
-		for (i = 0; matching && query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (query[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				if (query[i].value.s == NULL || 
-					strcmp(query[i].value.s, owner)) matching = 0;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				switch (query[i].op) {
-					case GLITE_JP_QUERYOP_EQUAL:
-						matching = !compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_UNEQUAL:
-						matching = compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_LESS:
-						matching = compare_timeval(tv_reg, query[i].value.time) < 0;
-						break;
-					case GLITE_JP_QUERYOP_GREATER:
-						matching = compare_timeval(tv_reg, query[i].value.time) > 0;
-						break;
-					case GLITE_JP_QUERYOP_WITHIN:
-						matching = compare_timeval(tv_reg, query[i].value.time) >= 0
-							&& compare_timeval(tv_reg, query[i].value2.time) <= 0;
-						break;
-				}
-				break;
-			case GLITE_JP_ATTR_TAG:
-				if (!tags) {
-					matching = 0;
-					break;
-				}
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, query[i].attr.name)) {
-						switch (query[i].op) {
-						case GLITE_JP_QUERYOP_EQUAL:
-							matching = !strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_UNEQUAL:
-							matching = strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_LESS:
-							matching = strcmp(tags[j].value, query[i].value.s) < 0;
-							break;
-						case GLITE_JP_QUERYOP_GREATER:
-							matching = strcmp(tags[j].value, query[i].value.s) > 0;
-							break;
-						case GLITE_JP_QUERYOP_WITHIN:
-							matching = strcmp(tags[j].value, query[i].value.s) >= 0 \
-								&& strcmp(tags[j].value, query[i].value2.s) <= 0 ;
-							break;
-						default:
-							break;
-						}
-					}
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		if (!matching) {
-			free(info_fname); info_fname = NULL;
-			free(jobid); jobid = NULL;
-			if (tags) for (j = 0; tags[j].name != NULL; j++) {
-				free(tags[j].name);
-				free(tags[j].value);
-			}
-			free(tags); tags = NULL;
-			continue;
-		}
-
-		for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				metadata[i].value.s = owner;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				metadata[i].value.time = tv_reg;
-				break;
-			case GLITE_JP_ATTR_TAG:
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, metadata[i].attr.name)) {
-						if (glite_jpps_tagval_copy(ctx, &tags[j],
-							&metadata[i].value.tag)) {
-							err.code = ENOMEM;
-							err.desc = "Cannot copy tag value";
-							goto error_out;
-						}
-						break;
-					}
-				}
-				if (!tags[j].name) {
-					metadata[i].value.tag.name = NULL;
-					metadata[i].value.tag.value = NULL;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		(*callback)(ctx, jobid, metadata);
-		free(jobid); jobid = NULL;
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-	}
-
-error_out:
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	if (tags_handle) glite_jppsbe_close_file(ctx, tags_handle);
-	free(info_fname);
-	free(owner);
-	free(jobid);
-	closedir(time_dirp);
-	free(time_dirname);
-	if (err.code)  {
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else
-		return 0;
-}
-
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	/* XXX clone metadata */
-	int i;
-	char *q_exact_owner = NULL;
-	char *ownerhash = NULL;
-	long q_min_time = 0;
-	long q_max_time = LONG_MAX;
-	long q_min_time_tr;
-	long q_max_time_tr;
-	int q_with_tags = 0;
-	int md_info = 0;
-	int md_tags = 0;
-	char *owner_dirname = NULL;
-	DIR *owner_dirp = NULL;
-	struct dirent *ttimeent;
-	char *data_dirname = NULL;
-	DIR *data_dirp = NULL;
-	struct dirent *ownerent;
-	long ttime = 0;
-	glite_jp_attrval_t *metadata_templ = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		if (query[i].attr.type == GLITE_JP_ATTR_OWNER && query[i].op == GLITE_JP_QUERYOP_EQUAL) {
-			q_exact_owner = query[i].value.s;
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TIME) {
-			switch (query[i].op) {
-			case GLITE_JP_QUERYOP_EQUAL:
-				q_min_time = query[i].value.time.tv_sec;
-				q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_LESS:
-				if (q_max_time > query[i].value.time.tv_sec + 1)
-					q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_WITHIN:
-				if (q_max_time > query[i].value2.time.tv_sec + 1)
-					q_max_time = query[i].value2.time.tv_sec + 1;
-				/* fallthrough */
-			case GLITE_JP_QUERYOP_GREATER:
-				if (q_min_time < query[i].value.time.tv_sec)
-					q_min_time = query[i].value.time.tv_sec;
-				break;
-			default:
-				err.code = EINVAL;
-				err.desc = "Invalid query op";
-				return glite_jp_stack_error(ctx,&err);
-				break;
-			}
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TAG) 
-			q_with_tags = 1;
-
-	}
-
-	for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (metadata[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-		case GLITE_JP_ATTR_TIME:
-			md_info = 1;
-			break;
-		case GLITE_JP_ATTR_TAG:
-			md_tags = 1;
-			break;
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type in metadata parameter";
-			return glite_jp_stack_error(ctx,&err);
-			break;
-		}
-	}
-	metadata_templ = (glite_jp_attrval_t *) calloc(i + 1, sizeof(glite_jp_attrval_t));
-	if (!metadata_templ) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	memcpy(metadata_templ, metadata, (i + 1) * sizeof(glite_jp_attrval_t));
-	
-	q_min_time_tr = regtime_trunc(q_min_time);
-	q_max_time_tr = regtime_ceil(q_max_time);
-
-	if (q_exact_owner) {
-		ownerhash = str2md5(q_exact_owner); /* static buffer */
-		if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path, ownerhash) == -1) {
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		owner_dirp = opendir(owner_dirname);
-		free(owner_dirname);
-		if (!owner_dirp) {
-			free(metadata_templ);
-			return 0; /* found nothing */
-		}
-		while ((ttimeent = readdir(owner_dirp)) != NULL) {
-			if (!strcmp(ttimeent->d_name, ".")) continue;
-			if (!strcmp(ttimeent->d_name, "..")) continue;
-			ttime = atol(ttimeent->d_name);
-			if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-				if (query_phase2(ctx, ownerhash, ttime, q_with_tags, md_tags,
-						query, metadata_templ, callback)) {
-					err.code = EIO;
-					err.desc = "query_phase2() error";
-					goto error_out;
-				}
-			}
-		}
-	} else { /* !q_exact_owner */
-		if (asprintf(&data_dirname, "%s/data", config->internal_path) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		data_dirp = opendir(data_dirname);
-		if (!data_dirp) {
-			err.code = EIO;
-			err.desc = "Cannot open data directory";
-			goto error_out;
-		}
-		while ((ownerent = readdir(data_dirp)) != NULL) {
-			if (!strcmp(ownerent->d_name, ".")) continue;
-			if (!strcmp(ownerent->d_name, "..")) continue;
-			if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path,
-					ownerent->d_name) == -1) {
-				err.code = ENOMEM;
-				goto error_out;
-			}
-			owner_dirp = opendir(owner_dirname);
-			free(owner_dirname);
-			if (!owner_dirp) {
-				err.code = EIO;
-				err.desc = "Cannot open owner data directory";
-				goto error_out;
-			}
-			while ((ttimeent = readdir(owner_dirp)) != NULL) {
-				if (!strcmp(ttimeent->d_name, ".")) continue;
-				if (!strcmp(ttimeent->d_name, "..")) continue;
-				ttime = atol(ttimeent->d_name);
-				if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-					if (query_phase2(ctx, ownerent->d_name, ttime, q_with_tags, md_tags,
-							query, metadata_templ, callback)) {
-						err.code = EIO;
-						err.desc = "query_phase2() error";
-						goto error_out;
-					}
-				}
-			}
-			closedir(owner_dirp); owner_dirp = NULL;
-		}
-		closedir(data_dirp); data_dirp = NULL;
-	}
-	return 0;
-
-error_out:
-	if (owner_dirp) closedir(owner_dirp);
-	if (data_dirp) closedir(data_dirp);
-	free(data_dirname);
-	free(metadata_templ);
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#else 
-
-/* placeholder instead */
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	glite_jp_error_t	err;
-	err.code = ENOSYS;
-	err.desc = "not implemented";
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#endif
-
-/* XXX:
-- no primary authorization yet
-- no concurrency control yet
-- partial success in pwrite,append
-- "unique" part of jobid is assumed to be unique across bookkeeping servers
-- repository versioning not fully implemented yet
-*/
diff --git a/org.glite.jp.primary/src/is_client.c b/org.glite.jp.primary/src/is_client.c
deleted file mode 100644
index bb2ae45..0000000
--- a/org.glite.jp.primary/src/is_client.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-
-#include "feed.h"
-#include "is_client.h"
-/* FIXME
-#include "jpis_H.h"
-#include "jpis_.nsmap"
-*/
-
-int glite_jpps_single_feed(
-		glite_jp_context_t ctx,
-		const char *destination,
-		const char *job,
-		glite_jp_attrval_t const *attrs
-)
-{
-	/* TODO: really call JP Index server (via interlogger) */
-	printf("feed to %s, job %s\n",destination,job);
-
-/* FIXME */
-#if 0
-	if (soap_call_jpsrv__UpdateJobs(ctx->other_soap,destination,"",
-		/* FIXME: feedId */ "",
-		/* FIXME: UpdateJobsData */ NULL,
-		0,
-		NULL
-	)) fprintf(stderr,"UpdateJobs: %s %s\n",ctx->other_soap->fault->faultcode,
-		ctx->other_soap->fault->faultstring);
-
-#endif
-	return 0;
-}
diff --git a/org.glite.jp.primary/src/is_client.h b/org.glite.jp.primary/src/is_client.h
deleted file mode 100644
index a15d998..0000000
--- a/org.glite.jp.primary/src/is_client.h
+++ /dev/null
@@ -1 +0,0 @@
-int glite_jpps_single_feed(glite_jp_context_t,const char *,const char *,glite_jp_attrval_t const *);
diff --git a/org.glite.jp.primary/src/jptype_map.h b/org.glite.jp.primary/src/jptype_map.h
deleted file mode 100644
index c620c83..0000000
--- a/org.glite.jp.primary/src/jptype_map.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "soap_version.h"
-
-#if GSOAP_VERSION >= 20700
-#define INPUT_SANDBOX	jptype__UploadClass__INPUT_SANDBOX
-#define OUTPUT_SANDBOX	jptype__UploadClass__OUTPUT_SANDBOX
-#define JOB_LOG	jptype__UploadClass__JOB_LOG
-
-#define OWNER jptype__AttributeType__OWNER
-#define TIME jptype__AttributeType__TIME
-#define TAG jptype__AttributeType__TAG
-
-#define EQUAL jptype__queryOp__EQUAL
-#define UNEQUAL jptype__queryOp__UNEQUAL
-#define LESS jptype__queryOp__LESS
-#define GREATER jptype__queryOp__GREATER
-#define WITHIN jptype__queryOp__WITHIN
-
-#else
-
-#define __jpsrv__RegisterJob __ns1__RegisterJob
-#define __jpsrv__StartUpload __ns1__StartUpload
-#define __jpsrv__CommitUpload __ns1__CommitUpload
-#define __jpsrv__RecordTag __ns1__RecordTag
-#define __jpsrv__FeedIndex __ns1__FeedIndex
-#define __jpsrv__FeedIndexRefresh __ns1__FeedIndexRefresh
-#define __jpsrv__GetJob __ns1__GetJob
-
-#define SOAP_TYPE___jpsrv__RegisterJob SOAP_TYPE___ns1__RegisterJob
-#define SOAP_TYPE___jpsrv__StartUpload SOAP_TYPE___ns1__StartUpload
-#define SOAP_TYPE___jpsrv__CommitUpload SOAP_TYPE___ns1__CommitUpload
-#define SOAP_TYPE___jpsrv__GetJob SOAP_TYPE___ns1__GetJob
-
-#endif
-
diff --git a/org.glite.jp.primary/src/mysql.c b/org.glite.jp.primary/src/mysql.c
deleted file mode 100644
index 0f080ce..0000000
--- a/org.glite.jp.primary/src/mysql.c
+++ /dev/null
@@ -1,265 +0,0 @@
-#ident "$Header$"
-
-#include "mysql.h"	// MySql header file
-#include "mysqld_error.h"
-#include "errmsg.h"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "db.h"
-
-#define DEFAULTCS	"jpps/@localhost:jpps1"
-#define GLITE_JP_LB_MYSQL_VERSION 40018
-
-static int  my_err(glite_jp_context_t ctx, char *function)
-{	
-	glite_jp_error_t err; 
-
-  	glite_jp_clear_error(ctx); 
-	memset(&err,0,sizeof err); 
-	err.source = function;
-	err.code = EIO; /* XXX */
-	err.desc = mysql_error((MYSQL *) ctx->dbhandle); 
-	return glite_jp_stack_error(ctx,&err); 
-}
-
-struct _glite_jp_db_stmt_t {
-	MYSQL_RES		*result;
-	glite_jp_context_t	ctx;
-};
-
-int glite_jp_db_connect(glite_jp_context_t ctx,char *cs)
-{
-	char	*buf = NULL;
-	char	*host,*user,*pw,*db; 
-	char	*slash,*at,*colon;
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (!cs) cs = DEFAULTCS;
-
-	if (!(ctx->dbhandle = (void *) mysql_init(NULL))) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	mysql_options(ctx->dbhandle, MYSQL_READ_DEFAULT_FILE, "my");
-
-	host = user = pw = db = NULL;
-
-	buf = strdup(cs);
-	slash = strchr(buf,'/');
-	at = strrchr(buf,'@');
-	colon = strrchr(buf,':');
-
-	if (!slash || !at || !colon) {
-		free(buf);
-		err.code = EINVAL;
-		err.desc = "Invalid DB connect string";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	*slash = *at = *colon = 0;
-	host = at+1;
-	user = buf;
-	pw = slash+1;
-	db = colon+1;
-
-	if (!mysql_real_connect((MYSQL *) ctx->dbhandle,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) {
-		free(buf);
-		return my_err(ctx, __FUNCTION__);
-	}
-
-	free(buf);
-	return 0;
-}
-
-void glite_jp_db_close(glite_jp_context_t ctx)
-{
-	mysql_close((MYSQL *) ctx->dbhandle);
-	ctx->dbhandle = NULL;
-}
-
-int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *stmt)
-{
-	int	merr;
-	int	retry_nr = 0;
-	int	do_reconnect = 0;
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (stmt) {
-		*stmt = NULL;
-	}
-
-	while (retry_nr == 0 || do_reconnect) {
-		do_reconnect = 0;
-		if (mysql_query((MYSQL *) ctx->dbhandle,txt)) {
-			/* error occured */
-			switch (merr = mysql_errno((MYSQL *) ctx->dbhandle)) {
-				case 0:
-					break;
-				case ER_DUP_ENTRY: 
-					err.code = EEXIST;
-					err.desc = mysql_error((MYSQL *) ctx->dbhandle);
-					glite_jp_stack_error(ctx,&err);
-					return -1;
-					break;
-				case CR_SERVER_LOST:
-					if (retry_nr <= 0) 
-						do_reconnect = 1;
-					break;
-				default:
-					my_err(ctx, __FUNCTION__);
-					return -1;
-					break;
-			}
-		}
-		retry_nr++;
-	}
-
-	if (stmt) {
-		*stmt = malloc(sizeof(**stmt));
-		if (!*stmt) {
-			err.code = ENOMEM;
-			glite_jp_stack_error(ctx,&err);
-			return -1;
-		}
-		memset(*stmt,0,sizeof(**stmt));
-		(**stmt).ctx = ctx;
-		(**stmt).result = mysql_store_result((MYSQL *) ctx->dbhandle);
-		if (!(**stmt).result) {
-			if (mysql_errno((MYSQL *) ctx->dbhandle)) {
-				my_err(ctx, __FUNCTION__);
-				return -1;
-			}
-		}
-	} else {
-		MYSQL_RES	*r = mysql_store_result((MYSQL *) ctx->dbhandle);
-		mysql_free_result(r);
-	}
-	
-	return mysql_affected_rows((MYSQL *) ctx->dbhandle);
-}
-
-int glite_jp_db_fetchrow(glite_jp_db_stmt_t stmt,char **res)
-{
-	MYSQL_ROW	row;
-	glite_jp_context_t	ctx = stmt->ctx;
-	int 		nr,i;
-	unsigned long	*len;
-
-	glite_jp_clear_error(ctx);
-
-	if (!stmt->result) return 0;
-
-	if (!(row = mysql_fetch_row(stmt->result))) {
-		if (mysql_errno((MYSQL *) ctx->dbhandle)) {
-			my_err(ctx, __FUNCTION__);
-			return -1;
-		} else return 0;
-	}
-
-	nr = mysql_num_fields(stmt->result);
-	len = mysql_fetch_lengths(stmt->result);
-	for (i=0; iresult))) cols[i++] = f->name;
-	return i == 0;
-}
-
-void glite_jp_db_freestmt(glite_jp_db_stmt_t *stmt)
-{
-	if (*stmt) {
-		if ((**stmt).result) mysql_free_result((**stmt).result);
-		free(*stmt);
-		*stmt = NULL;
-	}
-}
-
-
-char *glite_jp_db_timetodb(time_t t)
-{
-	struct tm	*tm = gmtime(&t);
-	char	tbuf[256];
-
-	/* XXX: the very end of our days */
-	if (!tm && t == (time_t) LONG_MAX) return strdup("9999-12-31 23:59:59");
-
-	sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'",tm->tm_year+1900,tm->tm_mon+1,
-		tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
-	
-	return strdup(tbuf);
-}
-
-time_t glite_jp_db_dbtotime(char *t)
-{
-	struct tm	tm;
-
-	memset(&tm,0,sizeof(tm));
-	setenv("TZ","UTC",1); tzset();
-	sscanf(t,"%4d-%02d-%02d %02d:%02d:%02d",
-		&tm.tm_year,&tm.tm_mon,&tm.tm_mday,
-		&tm.tm_hour,&tm.tm_min,&tm.tm_sec);
-	tm.tm_year -= 1900;
-	tm.tm_mon--;
-
-	return mktime(&tm);
-}
-
-int glite_jp_db_dbcheckversion(glite_jp_context_t ctx)
-{
-	MYSQL	*m = (MYSQL *) ctx->dbhandle;
-	const   char *ver_s = mysql_get_server_info(m);
-	int	major,minor,sub,version;
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (!ver_s || 3 != sscanf(ver_s,"%d.%d.%d",&major,&minor,&sub)) {
-		err.code = EINVAL;
-		err.desc = "problem checking MySQL version";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	version = 10000*major + 100*minor + sub;
-
-	if (version < GLITE_JP_LB_MYSQL_VERSION) {
-		char	msg[300];
-
-		snprintf(msg,sizeof msg,"Your MySQL version is %d. At least %d required.",version, GLITE_JP_LB_MYSQL_VERSION);
-		err.code = EINVAL;
-		err.desc = msg;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
diff --git a/org.glite.jp.primary/src/new_ftp_backend.c b/org.glite.jp.primary/src/new_ftp_backend.c
deleted file mode 100644
index c94f20f..0000000
--- a/org.glite.jp.primary/src/new_ftp_backend.c
+++ /dev/null
@@ -1,1791 +0,0 @@
-#ident "$Header$"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-
-#include "tags.h"
-#include "backend.h"
-#include "db.h"
-
-#include "jpps_H.h"	/* XXX: SOAP_TYPE___jpsrv__GetJob */
-
-#include "jptype_map.h"
-
-#define FTPBE_DEFAULT_DB_CS	"jpps/@localhost:jpps"
-
-struct ftpbe_config {
-	char *internal_path;
-	char *external_path;
-	char *db_cs;
-//	char *gridmap;
-	char *logname;
-};
-
-static struct ftpbe_config *config = NULL;
-
-struct fhandle_rec {
-	int fd;
-	int fd_append;
-};
-typedef struct fhandle_rec *fhandle;
-
-static struct option ftpbe_opts[] = {
-	{ "ftp-internal-path", 1, NULL, 'I' },
-	{ "ftp-external-path", 1, NULL,	'E' },
-	{ "ftp-db-cs",	       1, NULL,	'D' },
-//	{ "ftp-gridmap",       1, NULL,	'G' },
-	{ NULL,                0, NULL,  0  }
-};
-
-/*******************************************************************************
-	Internal helpers
-*******************************************************************************/
-
-
-static int config_check(
-	glite_jp_context_t ctx,
-	struct ftpbe_config *config)
-{
-	return config == NULL ||
-		config->internal_path == NULL ||
-		config->external_path == NULL ||
-		config->db_cs == NULL ||
-//		config->gridmap == NULL ||
-		config->logname == NULL;
-
-	/* XXX check reality */
-}
-
-static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job, 
-			  char **unique, char **ju_path, int get_path)
-{
-	char *p;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	p = strrchr(job, '/');
-	if (!p) {
-		err.code = EINVAL;
-		err.desc = "Malformed jobid";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	/* XXX thorough checks */
-	if (!(*unique = strdup(p+1))) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (get_path) {
-		if (!(*ju_path = strdup(p+1))) {
-			free(*unique);
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		*(*ju_path + 10) = '\0';
-	}
-	return 0;
-}
-
-static int mkdirpath(const char* path, int prefixlen)
-{
-	char *wpath, *p;
-	int goout, ret;
-
-	wpath = strdup(path);
-	if (!wpath) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	p = wpath + prefixlen;
-	goout = 0;
-	while (!goout) {
-		while (*p == '/') p++;
-		while (*p != '/' && *p != '\0') p++;
-		goout = (*p == '\0');
-		*p = '\0';
-		ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR);
-		if (ret < 0 && errno != EEXIST) break;
-		*p = '/';
-	}
-	free(wpath);
-	return goout ? 0 : ret;
-}
-
-static int store_user(glite_jp_context_t ctx, const char *userid, const char *subj)
-{
-	glite_jp_error_t err;
-	char *stmt;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	assert(userid != NULL);
-	assert(subj != NULL);
-
-	trio_asprintf(&stmt,"insert into users(userid,cert_subj) "
-		"values ('%|Ss','%|Ss')",userid,subj);
-	if (!stmt) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		if (ctx->error->code == EEXIST) 
-			glite_jp_clear_error(ctx);
-		else {
-			free(stmt);
-			err.code = EIO;
-			err.desc = "DB access failed";
-			return glite_jp_stack_error(ctx,&err);
-		}
-	}
-	free(stmt);
-
-	return 0;
-}
-
-static long regtime_trunc(long tv_sec)
-{
-	return tv_sec / (86400*7);
-}
-
-static long regtime_ceil(long tv_sec)
-{
-	return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ;
-}
-
-/********************************************************************************
-	Backend calls
-********************************************************************************/
-int glite_jppsbe_init(
-	glite_jp_context_t ctx,
-	int argc,
-	char *argv[]
-)
-{
-	glite_jp_error_t err;
-	int opt;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	config = (struct ftpbe_config *) calloc(1, sizeof *config);
-	if (!config) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	config->logname = getlogin();
-
-	while ((opt = getopt_long(argc, argv, "I:E:" /* G: */, ftpbe_opts, NULL)) != EOF) {
-		switch (opt) {
-			case 'I': config->internal_path = optarg; break;
-			case 'E': config->external_path = optarg; break;
-			case 'D': config->db_cs = optarg; break;
-//			case 'G': config->gridmap = optarg; break;
-			default: break;
-		}
-	}
-
-	/* Defaults */
-	if (!config->db_cs) config->db_cs = strdup(FTPBE_DEFAULT_DB_CS);
-
-	if (config_check(ctx, config)) {
-		err.code = EINVAL;
-		err.desc = "Invalid FTP backend configuration";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jp_db_connect(ctx, config->db_cs)) {
-		err.code = EIO;
-		err.desc = "Cannot access backend's database (during init)";
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		glite_jp_db_close(ctx); /* slaves open their own connections */
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_init_slave(
-	glite_jp_context_t ctx
-)
-{
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	if (glite_jp_db_connect(ctx, config->db_cs)) {
-		err.code = EIO;
-		err.desc = "Cannot access backend's database";
-		return glite_jp_stack_error(ctx,&err);
-	} 
-
-	return 0;
-}
-
-int glite_jppsbe_register_job(	
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *owner
-)
-{
-	glite_jp_error_t err;
-	char *data_dir = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *ownerhash = NULL;
-	struct timeval reg_tv;
-	char *stmt = NULL;
-	char *dbtime = NULL;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job != NULL);
-	assert(owner != NULL);
-
-	gettimeofday(®_tv, NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	ownerhash = str2md5(owner); /* static buffer */
-	if (store_user(ctx, ownerhash, owner)) {
-		err.code = EIO;
-		err.desc = "Cannot store user entry";
-		goto error_out;
-	}
-
-	dbtime = glite_jp_db_timetodb(reg_tv.tv_sec);
-	if (!dbtime) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	trio_asprintf(&stmt,"insert into jobs(jobid,dg_jobid,owner,reg_time) "
-		"values ('%|Ss','%|Ss','%|Ss', %s)",
-		ju, job, ownerhash, dbtime);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		if (ctx->error->code == EEXIST) {
-			err.code = EEXIST;
-			err.desc = "Job already registered";
-		}
-		else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	if (asprintf(&data_dir, "%s/data/%s/%d/%s",
-			config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 &&
-			errno != EEXIST) {
-		err.code = errno;
-		err.desc = "Cannot mkdir jobs's data directory";
-		goto error_out;
-	}
-
-error_out:
-	free(data_dir);
-	free(stmt); free(dbtime);
-	free(ju); free(ju_path);
-
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-#if 0
-static int add_to_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	gridmap = fopen(config->gridmap, "a");
-	if (!gridmap) {
-		err.code = errno;
-		err.desc = "Cannot open gridmap file";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 ||
-		ferror(gridmap)) {
-		err.code = EIO;
-		err.desc = "Cannot write to gridmap file";
-		fclose(gridmap);
-		return glite_jp_stack_error(ctx,&err);
-	}
-	fclose(gridmap);
-	return 0;
-}
-
-static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn)
-{
-	FILE *gridmap = NULL;
-	char *temp_name = NULL;
-	FILE *temp_file = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	
-	/* XXX */
-	return 0;
-}
-#endif
-
-int glite_jppsbe_start_upload(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	
-	const char *content_type,
-	char **destination_out,
-	time_t *commit_before_inout
-)
-{
-	char *data_basename = NULL;
-	char *data_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-	char *peername = NULL;
-	char *peerhash = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[2] = { NULL, NULL };
-
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(destination_out!=NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	peername = glite_jp_peer_name(ctx);
-	if (peername == NULL) {
-		err.code = EINVAL;
-		err.desc = "Cannot obtain client certificate info";
-		goto error_out;
-	}
-
-	trio_asprintf(&stmt, "select owner, reg_time from jobs"
-		" where jobid='%|Ss'", ju);
-
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such job registered";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-	
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 2) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-
-	glite_jp_db_freestmt(&db_res);
-	
-	/* XXX authorization done in soap_ops.c */
-
-	/* XXX name length */
-	if (asprintf(&data_basename, "%s%s%s", class,
-		(name != NULL) ? "." : "",
-		(name != NULL) ? name : "") == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(&data_fname, "%s/data/%s/%d/%s/%s",
-			config->internal_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	if (asprintf(destination_out, "%s/data/%s/%d/%s/%s",
-			config->external_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (commit_before_inout != NULL)
-	/* XXX no timeout enforced */
-		/* XXX: gsoap does not like so much, one year should be enough
-		*commit_before_inout = (time_t) LONG_MAX;
-		*/
-		*commit_before_inout = time(NULL) + 365*24*60*60;
-	
-	/* 
-	if (add_to_gridmap(ctx, peername)) {
-		err.code = EIO;
-		err.desc = "Cannot add peer DN to ftp server authorization file";
-		goto error_out;
-	}
-	*/
-
-	peerhash = str2md5(peername); /* static buffer */
-	if (store_user(ctx, peerhash, peername)) {
-		err.code = EIO;
-		err.desc = "Cannot store upload user entry";
-		goto error_out;
-	}
-
-	free(stmt); stmt = NULL;
-	trio_asprintf(&stmt,"insert into files"
-		"(jobid,filename,int_path,ext_url,state,deadline,ul_userid) "
-		"values ('%|Ss','%|Ss','%|Ss','%|Ss','%|Ss', '%|Ss', '%|Ss')",
-		ju, data_basename, data_fname, *destination_out, "uploading", 
-		glite_jp_db_timetodb(*commit_before_inout), peerhash);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		if (ctx->error->code == EEXIST) {
-			err.code = EEXIST;
-			err.desc = "File already stored or upload in progress";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-	
-error_out:
-	free(db_row[0]); free(db_row[1]);
-	free(stmt);
-	free(data_basename); 
-	free(data_fname); 
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_commit_upload(
-	glite_jp_context_t ctx,
-	const char *destination
-)
-{
-	char *peername = NULL;
-	char *peerhash = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-	int i;
-	
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(destination != NULL);
-
-	trio_asprintf(&stmt, "select * from files where "
-			     "ext_url='%|Ss' and state='uploading'", destination);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such upload in progress";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 7) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-	glite_jp_db_freestmt(&db_res);
-
-	peername = glite_jp_peer_name(ctx);
-	if (peername == NULL) {
-		err.code = EINVAL;
-		err.desc = "Cannot obtain client certificate info";
-		goto error_out;
-	}
-
-	peerhash = str2md5(peername); /* static buffer */
-	if (strcmp(peerhash, db_row[6])) {
-		err.code = EPERM;
-		err.desc = "Upload started by client with different identity";
-		goto error_out;
-	}
-
-	free(stmt);
-	trio_asprintf(&stmt,"update files set state='committed', deadline=NULL "
-		"where jobid='%|Ss' and filename='%|Ss'", db_row[0], db_row[1]);
-	
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-error_out:
-	for (i=0; i<7; i++) free(db_row[i]);
-	free(peername);
-	free(stmt);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-int glite_jppsbe_destination_info(
-	glite_jp_context_t ctx,
-	const char *destination,
-	char **job,
-	char **class,
-	char **name
-)
-{
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[2] = { NULL, NULL};
-	int i;
-	char *cp = NULL;
-	
-	char *classname = NULL;
-	glite_jp_error_t err;
-
-	assert(destination != NULL);
-	assert(job != NULL);
-	assert(class != NULL);
-	assert(name != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	
-	trio_asprintf(&stmt, "select j.dg_jobid,f.filename from jobs j,files f where "
-			     "f.ext_url='%|Ss' and j.jobid=f.jobid", destination);
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "Invalid destination string";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 2) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-	glite_jp_db_freestmt(&db_res);
-
-	*job = strdup(db_row[0]);
-
-	cp = strchr(db_row[1],'.');
-	if (!cp) { 
-		*name = NULL;
-	} else {
-		*cp++ = '\0';
-		*name = strdup(cp);
-	}
-	*class = strdup(db_row[1]);
-
-	if (!*job || !*class)  {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	for (i=0; i<2; i++) free(db_row[i]);
-	free(stmt);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-
-int glite_jppsbe_get_job_url(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	
-	char **url_out
-)
-{
-	char *data_basename = NULL;
-	char *data_fname = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[3] = { NULL, NULL, NULL };
-
-	long reg_time;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(url_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/ : ""name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	trio_asprintf(&stmt, "select j.owner,reg_time,u.cert_subj from jobs j, users u "
-		"where j.jobid='%|Ss' and j.owner = u.userid", ju);
-
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such job registered";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-
-	free(stmt); stmt = NULL;
-	
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 3) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-
-	glite_jp_db_freestmt(&db_res);
-
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobFiles,job,db_row[2])) {
-		err.code = EPERM;
-		goto error_out;
-	}
-	
-	/* XXX name length */
-	if (asprintf(&data_basename, "%s%s%s", class,
-		(name != NULL) ? "." : "",
-		(name != NULL) ? name : "") == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(url_out, "%s/data/%s/%d/%s/%s",
-			config->external_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	trio_asprintf(&stmt,"select 'x' from files where jobid='%|Ss' "
-				"and ext_url = '%|Ss' "
-				"and state='committed' ",ju,*url_out);
-
-	if ((db_retn = glite_jp_db_execstmt(ctx,stmt,&db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "not uploaded yet";
-		}
-		else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		/* goto error_out; */
-	}
-
-error_out:
-	free(db_row[0]); free(db_row[1]);
-	free(stmt);
-	free(data_basename);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-static int get_job_fname(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name, 	
-	char **fname_out
-)
-{
-	char *data_basename = NULL;
-	char *ju = NULL;
-	char *ju_path = NULL;
-
-	char *stmt = NULL;
-	glite_jp_db_stmt_t db_res;
-	int db_retn;
-	char *db_row[2] = { NULL, NULL };
-
-	long reg_time;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	assert(job!=NULL);
-	assert(fname_out != NULL);
-
-	assert(class!=NULL);
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	trio_asprintf(&stmt, "select owner, reg_time from jobs "
-		"where jobid='%|Ss'", ju);
-
-	if (!stmt) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
-		if (db_retn == 0) {
-			err.code = ENOENT;
-			err.desc = "No such job registered";
-		} else {
-			err.code = EIO;
-			err.desc = "DB access failed";
-		}
-		goto error_out;
-	}
-	
-	db_retn = glite_jp_db_fetchrow(db_res, db_row);
-	if (db_retn != 2) {
-		glite_jp_db_freestmt(&db_res);
-		err.code = EIO;
-		err.desc = "DB access failed";
-		goto error_out;
-	}
-
-	glite_jp_db_freestmt(&db_res);
-	
-	/* XXX name length */
-	if (asprintf(&data_basename, "%s%s%s", class,
-		(name != NULL) ? "." : "", (name != NULL) ? name : "") == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	if (asprintf(fname_out, "%s/data/%s/%d/%s/%s",
-			config->internal_path, db_row[0],
-			regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
-			ju, data_basename) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-error_out:
-	free(db_row[0]); free(db_row[1]);
-	free(stmt);
-	free(data_basename);
-	free(ju); free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-
-
-int glite_jppsbe_open_file(
-	glite_jp_context_t ctx,
-	const char *job,
-	const char *class,
-	const char *name,
-	int mode,
-	void **handle_out
-)
-{
-	fhandle	handle = NULL;
-	char* fname = NULL;
-	glite_jp_error_t err;
-
-	assert(handle_out != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (get_job_fname(ctx, job, class, name, &fname)) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot construct internal filename";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	handle = (fhandle) calloc(1,sizeof(*handle));
-	if (handle == NULL) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-
-	handle->fd = open(fname, mode, S_IRUSR | S_IWUSR);
-	if (handle->fd < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file";
-		free(handle);
-		goto error_out;
-	}
-	handle->fd_append = open(fname, mode | O_APPEND, S_IRUSR | S_IWUSR);
-	if (handle->fd_append < 0) {
-		err.code = errno;
-		err.desc = "Cannot open requested file for append";
-		close(handle->fd);
-		free(handle);
-		goto error_out;
-	}
-	*handle_out = (void*) handle;
-
-error_out:
-	free(fname);
-	if (err.code) { 
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_close_file(
-	glite_jp_context_t ctx,
-	void *handle
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (close(((fhandle)handle)->fd_append) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor (fd_append)";
-		goto error_out;
-	}
-	if (close(((fhandle)handle)->fd) < 0) {
-		err.code = errno;
-		err.desc = "Error closing file descriptor";
-		goto error_out;
-	}
-
-error_out:
-	free(handle);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_pread(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset,
-	ssize_t *nbytes_ret
-)
-{
-	ssize_t ret;
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if ((ret = pread(((fhandle)handle)->fd, buf, nbytes, offset)) < 0) {
-		err.code = errno;
-		err.desc = "Error in pread()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	*nbytes_ret = ret;
-
-	return 0;
-}
-
-int glite_jppsbe_pwrite(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes,
-	off_t offset
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (pwrite(((fhandle)handle)->fd, buf, nbytes, offset) < 0) {
-		err.code = errno;
-		err.desc = "Error in pwrite()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jppsbe_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	void *buf,
-	size_t nbytes
-)
-{
-	glite_jp_error_t err;
-
-	assert(handle != NULL);
-	assert(buf != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (write(((fhandle)handle)->fd_append, buf, nbytes) < 0) {
-		err.code = errno;
-		err.desc = "Error in write()";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-static int get_job_info(
-	glite_jp_context_t ctx,
-	const char *job,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	char *ju = NULL;
-	char *ju_path = NULL;
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char *int_fname = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
-		err.code = ctx->error->code;
-		err.desc = "Cannot obtain jobid unique path/name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (asprintf(&int_fname, "%s/regs/%s/%s.info",
-			config->internal_path, ju_path, ju) == -1) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		if (errno == ENOENT) 
-			err.desc = "Job not registered";
-		else
-			err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %*s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, &ownerlen) < 4 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	free(int_fname);
-	free(ju);
-	free(ju_path);
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-static int get_job_info_int(
-	glite_jp_context_t ctx,
-	const char *int_fname,
-	char **jobid,
-	char **owner,
-	struct timeval *tv_reg
-)
-{
-	FILE *regfile = NULL;
-	long reg_time_sec;
-	long reg_time_usec;
-	int ownerlen = 0;
-	int info_version;
-	char jobid_buf[256];
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	regfile = fopen(int_fname, "r");
-	if (regfile == NULL) {
-		err.code = errno;
-		err.desc = "Cannot open jobs's reg info file";
-		goto error_out;
-	}
-	if (fscanf(regfile, "%d %ld.%ld %s %*s %d ", &info_version,
-		®_time_sec, ®_time_usec, jobid_buf, &ownerlen) < 5 || ferror(regfile)) {
-		fclose(regfile);
-		err.code = errno;
-		err.desc = "Cannot read jobs's reg info file";
-		goto error_out;
-	}
-	*jobid = strdup(jobid_buf);
-	if (ownerlen) {
-		*owner = (char *) calloc(1, ownerlen+1);
-		if (!*owner) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (fgets(*owner, ownerlen+1, regfile) == NULL) {
-			fclose(regfile);
-			free(*owner);
-			err.code = errno;
-			err.desc = "Cannot read jobs's reg info file";
-			goto error_out;
-		}
-	}
-	fclose(regfile);
-
-	tv_reg->tv_sec = reg_time_sec;
-	tv_reg->tv_usec = reg_time_usec;
-
-error_out:
-	if (err.code) {
-		return glite_jp_stack_error(ctx,&err);
-	} else { 
-		return 0;
-	}
-}
-
-int glite_jppsbe_get_job_metadata(
-	glite_jp_context_t ctx,
-	const char *job,
-	glite_jp_attrval_t attrs_inout[]
-)
-{
-	int got_info = 0;
-	struct timeval tv_reg;
-	char *owner = NULL;
-/* do in plugin
-	int got_tags = 0;
-	void *tags_handle = NULL;
-	glite_jp_tagval_t* tags = NULL;
-*/
-	int i,j;
-	glite_jp_error_t err;
-
-	assert(job != NULL);
-	assert(attrs_inout != NULL);
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; attrs_inout[i].name; i++) {
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TIME:
-*/
-		if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_OWNER)) {
-			if (!got_info) {
-				if (get_job_info(ctx, job, &owner, &tv_reg)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot retrieve job info";
-					goto error_out;
-				}
-				got_info = 1;
-			}
-		}
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			if (!got_tags) {
-				if (glite_jppsbe_open_file(ctx, job, GLITE_JP_FILECLASS_TAGS,
-					O_RDONLY, &tags_handle)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot open tag file";
-					goto error_out;
-				}
-				if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-					err.code = ctx->error->code;
-					err.desc = "Cannot read tags";
-					glite_jppsbe_close_file(ctx, tags_handle);
-					goto error_out;
-				}
-				glite_jppsbe_close_file(ctx, tags_handle);
-				got_tags = 1;
-			}
-			break;
-*/
-		else {
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type";
-			goto error_out;
-			break;
-		}
-
-		if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_OWNER)) {
-			attrs_inout[i].value = strdup(owner);
-			if (!attrs_inout[i].value) {
-				err.code = ENOMEM;
-				err.desc = "Cannot copy owner string";
-				goto error_out;
-			}	
-			attrs_inout[i].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
-			attrs_inout[i].origin_detail = NULL;
-
-			/* FIXME: we must store job registration time somewhere */
-			attrs_inout[i].timestamp = 0;
-		}
-	
-/* TODO:
-		case GLITE_JP_ATTR_TIME:
-			attrs_inout[i].value.time = tv_reg;
-			break;
-*/
-
-/* must be implemented via filetype plugin
-		case GLITE_JP_ATTR_TAG:
-			for (j = 0; tags[j].name != NULL; j++) {
-				if (!strcmp(tags[j].name, attrs_inout[i].attr.name)) {
-					if (glite_jpps_tagval_copy(ctx, &tags[j],
-						&attrs_inout[i].value.tag)) {
-						err.code = ENOMEM;
-						err.desc = "Cannot copy tag value";
-						goto error_out;
-					}
-					break;
-				}
-			}
-			if (!tags[j].name) attrs_inout[i].value.tag.name = NULL;
-			break;
-*/
-	}
-
-error_out:
-	free(owner);
-/* plugin
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	free(tags);
-*/
-	
-	if (err.code) {
-		while (i > 0) {
-			i--;
-			glite_jp_attrval_free(attrs_inout+i,0);
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else {
-		return 0;
-	}
-}
-static int compare_timeval(struct timeval a, struct timeval b)
-{
-	if (a.tv_sec < b.tv_sec) return -1;
-	if (a.tv_sec > b.tv_sec) return 1;
-	if (a.tv_usec < b.tv_usec) return -1;
-	if (a.tv_usec > b.tv_usec) return 1;
-	return 0;
-}
-
-
-/* FIXME: disabled -- clarification wrt. filetype plugin needed */
-
-#if 0
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-);
-
-static int query_phase2(
-	glite_jp_context_t ctx,
-	const char *ownerhash,
-	long regtime_tr,
-	int q_tags,
-	int md_tags,
-	const glite_jp_query_rec_t query[],
-	glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	char *time_dirname = NULL;
-	DIR *time_dirp = NULL;
-	struct dirent *jobent;
-	char *info_fname = NULL;
-	char *jobid = NULL;
-	char *owner = NULL;
-	struct timeval tv_reg;
-	void *tags_handle = NULL;
-	int matching;
-	int i, j;
-	glite_jp_tagval_t* tags = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	if (asprintf(&time_dirname, "%s/data/%s/%d", config->internal_path,
-			ownerhash, regtime_tr) == -1) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	time_dirp = opendir(time_dirname);
-	if (!time_dirp) {
-		free(time_dirname);
-		return 0; /* found nothing */
-	}
-	while ((jobent = readdir(time_dirp)) != NULL) {
-		if (!strcmp(jobent->d_name, ".")) continue;
-		if (!strcmp(jobent->d_name, "..")) continue;
-		if (asprintf(&info_fname, "%s/%s/_info", time_dirname,
-				jobent->d_name) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		if (get_job_info_int(ctx, info_fname, &jobid, &owner,  &tv_reg)) {
-			err.code = EIO;
-			err.desc = "Cannot retrieve job info";
-			goto error_out;
-		}
-		if (q_tags || md_tags) {
-			if (glite_jppsbe_open_file(ctx, jobid, GLITE_JP_FILECLASS_TAGS,
-				O_RDONLY, &tags_handle)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot open tag file";
-				goto error_out;
-			}
-			if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
-				err.code = ctx->error->code;
-				err.desc = "Cannot read tags";
-				glite_jppsbe_close_file(ctx, tags_handle);
-				goto error_out;
-			}
-			glite_jppsbe_close_file(ctx, tags_handle);
-			tags_handle = NULL;
-		}
-
-		matching = 1;
-		for (i = 0; matching && query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (query[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				if (query[i].value.s == NULL || 
-					strcmp(query[i].value.s, owner)) matching = 0;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				switch (query[i].op) {
-					case GLITE_JP_QUERYOP_EQUAL:
-						matching = !compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_UNEQUAL:
-						matching = compare_timeval(tv_reg, query[i].value.time);
-						break;
-					case GLITE_JP_QUERYOP_LESS:
-						matching = compare_timeval(tv_reg, query[i].value.time) < 0;
-						break;
-					case GLITE_JP_QUERYOP_GREATER:
-						matching = compare_timeval(tv_reg, query[i].value.time) > 0;
-						break;
-					case GLITE_JP_QUERYOP_WITHIN:
-						matching = compare_timeval(tv_reg, query[i].value.time) >= 0
-							&& compare_timeval(tv_reg, query[i].value2.time) <= 0;
-						break;
-				}
-				break;
-			case GLITE_JP_ATTR_TAG:
-				if (!tags) {
-					matching = 0;
-					break;
-				}
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, query[i].attr.name)) {
-						switch (query[i].op) {
-						case GLITE_JP_QUERYOP_EQUAL:
-							matching = !strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_UNEQUAL:
-							matching = strcmp(tags[j].value, query[i].value.s);
-							break;
-						case GLITE_JP_QUERYOP_LESS:
-							matching = strcmp(tags[j].value, query[i].value.s) < 0;
-							break;
-						case GLITE_JP_QUERYOP_GREATER:
-							matching = strcmp(tags[j].value, query[i].value.s) > 0;
-							break;
-						case GLITE_JP_QUERYOP_WITHIN:
-							matching = strcmp(tags[j].value, query[i].value.s) >= 0 \
-								&& strcmp(tags[j].value, query[i].value2.s) <= 0 ;
-							break;
-						default:
-							break;
-						}
-					}
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		if (!matching) {
-			free(info_fname); info_fname = NULL;
-			free(jobid); jobid = NULL;
-			if (tags) for (j = 0; tags[j].name != NULL; j++) {
-				free(tags[j].name);
-				free(tags[j].value);
-			}
-			free(tags); tags = NULL;
-			continue;
-		}
-
-		for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_OWNER:
-				metadata[i].value.s = owner;
-				break;
-			case GLITE_JP_ATTR_TIME:
-				metadata[i].value.time = tv_reg;
-				break;
-			case GLITE_JP_ATTR_TAG:
-				for (j = 0; tags[j].name != NULL; j++) {
-					if (!strcmp(tags[j].name, metadata[i].attr.name)) {
-						if (glite_jpps_tagval_copy(ctx, &tags[j],
-							&metadata[i].value.tag)) {
-							err.code = ENOMEM;
-							err.desc = "Cannot copy tag value";
-							goto error_out;
-						}
-						break;
-					}
-				}
-				if (!tags[j].name) {
-					metadata[i].value.tag.name = NULL;
-					metadata[i].value.tag.value = NULL;
-				}
-				break;
-			default:
-				break;
-			}
-		}
-		(*callback)(ctx, jobid, metadata);
-		free(jobid); jobid = NULL;
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-	}
-
-error_out:
-	if (tags) for (j = 0; tags[j].name != NULL; j++) {
-		free(tags[j].name);
-		free(tags[j].value);
-	}
-	if (tags_handle) glite_jppsbe_close_file(ctx, tags_handle);
-	free(info_fname);
-	free(owner);
-	free(jobid);
-	closedir(time_dirp);
-	free(time_dirname);
-	if (err.code)  {
-		while (i > 0) {
-			i--;
-			switch (metadata[i].attr.type) {
-			case GLITE_JP_ATTR_TAG:
-				free(metadata[i].value.tag.name);
-				free(metadata[i].value.tag.value);
-			default:
-				break;
-			}
-		}
-		return glite_jp_stack_error(ctx,&err);
-	} else
-		return 0;
-}
-
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	/* XXX clone metadata */
-	int i;
-	char *q_exact_owner = NULL;
-	char *ownerhash = NULL;
-	long q_min_time = 0;
-	long q_max_time = LONG_MAX;
-	long q_min_time_tr;
-	long q_max_time_tr;
-	int q_with_tags = 0;
-	int md_info = 0;
-	int md_tags = 0;
-	char *owner_dirname = NULL;
-	DIR *owner_dirp = NULL;
-	struct dirent *ttimeent;
-	char *data_dirname = NULL;
-	DIR *data_dirp = NULL;
-	struct dirent *ownerent;
-	long ttime = 0;
-	glite_jp_attrval_t *metadata_templ = NULL;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	for (i = 0; query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		if (query[i].attr.type == GLITE_JP_ATTR_OWNER && query[i].op == GLITE_JP_QUERYOP_EQUAL) {
-			q_exact_owner = query[i].value.s;
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TIME) {
-			switch (query[i].op) {
-			case GLITE_JP_QUERYOP_EQUAL:
-				q_min_time = query[i].value.time.tv_sec;
-				q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_LESS:
-				if (q_max_time > query[i].value.time.tv_sec + 1)
-					q_max_time = query[i].value.time.tv_sec + 1;
-				break;
-			case GLITE_JP_QUERYOP_WITHIN:
-				if (q_max_time > query[i].value2.time.tv_sec + 1)
-					q_max_time = query[i].value2.time.tv_sec + 1;
-				/* fallthrough */
-			case GLITE_JP_QUERYOP_GREATER:
-				if (q_min_time < query[i].value.time.tv_sec)
-					q_min_time = query[i].value.time.tv_sec;
-				break;
-			default:
-				err.code = EINVAL;
-				err.desc = "Invalid query op";
-				return glite_jp_stack_error(ctx,&err);
-				break;
-			}
-		}
-		if (query[i].attr.type == GLITE_JP_ATTR_TAG) 
-			q_with_tags = 1;
-
-	}
-
-	for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
-		switch (metadata[i].attr.type) {
-		case GLITE_JP_ATTR_OWNER:
-		case GLITE_JP_ATTR_TIME:
-			md_info = 1;
-			break;
-		case GLITE_JP_ATTR_TAG:
-			md_tags = 1;
-			break;
-		default:
-			err.code = EINVAL;
-			err.desc = "Invalid attribute type in metadata parameter";
-			return glite_jp_stack_error(ctx,&err);
-			break;
-		}
-	}
-	metadata_templ = (glite_jp_attrval_t *) calloc(i + 1, sizeof(glite_jp_attrval_t));
-	if (!metadata_templ) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	memcpy(metadata_templ, metadata, (i + 1) * sizeof(glite_jp_attrval_t));
-	
-	q_min_time_tr = regtime_trunc(q_min_time);
-	q_max_time_tr = regtime_ceil(q_max_time);
-
-	if (q_exact_owner) {
-		ownerhash = str2md5(q_exact_owner); /* static buffer */
-		if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path, ownerhash) == -1) {
-			err.code = ENOMEM;
-			return glite_jp_stack_error(ctx,&err);
-		}
-		owner_dirp = opendir(owner_dirname);
-		free(owner_dirname);
-		if (!owner_dirp) {
-			free(metadata_templ);
-			return 0; /* found nothing */
-		}
-		while ((ttimeent = readdir(owner_dirp)) != NULL) {
-			if (!strcmp(ttimeent->d_name, ".")) continue;
-			if (!strcmp(ttimeent->d_name, "..")) continue;
-			ttime = atol(ttimeent->d_name);
-			if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-				if (query_phase2(ctx, ownerhash, ttime, q_with_tags, md_tags,
-						query, metadata_templ, callback)) {
-					err.code = EIO;
-					err.desc = "query_phase2() error";
-					goto error_out;
-				}
-			}
-		}
-	} else { /* !q_exact_owner */
-		if (asprintf(&data_dirname, "%s/data", config->internal_path) == -1) {
-			err.code = ENOMEM;
-			goto error_out;
-		}
-		data_dirp = opendir(data_dirname);
-		if (!data_dirp) {
-			err.code = EIO;
-			err.desc = "Cannot open data directory";
-			goto error_out;
-		}
-		while ((ownerent = readdir(data_dirp)) != NULL) {
-			if (!strcmp(ownerent->d_name, ".")) continue;
-			if (!strcmp(ownerent->d_name, "..")) continue;
-			if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path,
-					ownerent->d_name) == -1) {
-				err.code = ENOMEM;
-				goto error_out;
-			}
-			owner_dirp = opendir(owner_dirname);
-			free(owner_dirname);
-			if (!owner_dirp) {
-				err.code = EIO;
-				err.desc = "Cannot open owner data directory";
-				goto error_out;
-			}
-			while ((ttimeent = readdir(owner_dirp)) != NULL) {
-				if (!strcmp(ttimeent->d_name, ".")) continue;
-				if (!strcmp(ttimeent->d_name, "..")) continue;
-				ttime = atol(ttimeent->d_name);
-				if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
-					if (query_phase2(ctx, ownerent->d_name, ttime, q_with_tags, md_tags,
-							query, metadata_templ, callback)) {
-						err.code = EIO;
-						err.desc = "query_phase2() error";
-						goto error_out;
-					}
-				}
-			}
-			closedir(owner_dirp); owner_dirp = NULL;
-		}
-		closedir(data_dirp); data_dirp = NULL;
-	}
-	return 0;
-
-error_out:
-	if (owner_dirp) closedir(owner_dirp);
-	if (data_dirp) closedir(data_dirp);
-	free(data_dirname);
-	free(metadata_templ);
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#else 
-
-/* placeholder instead */
-int glite_jppsbe_query(
-	glite_jp_context_t ctx,
-	const glite_jp_query_rec_t query[],
-	const glite_jp_attrval_t metadata[],
-	int (*callback)(
-		glite_jp_context_t ctx,
-		const char *job,
-		const glite_jp_attrval_t metadata[]
-	)
-)
-{
-	glite_jp_error_t	err;
-	err.code = ENOSYS;
-	err.desc = "not implemented";
-	return glite_jp_stack_error(ctx,&err);
-}
-
-#endif
-
-/* XXX:
-- no primary authorization yet
-- no concurrency control yet
-- partial success in pwrite,append
-- "unique" part of jobid is assumed to be unique across bookkeeping servers
-- repository versioning not fully implemented yet
-*/
diff --git a/org.glite.jp.primary/src/simple_server.c b/org.glite.jp.primary/src/simple_server.c
deleted file mode 100644
index 3bbb743..0000000
--- a/org.glite.jp.primary/src/simple_server.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpps_H.h"
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-
-int main(int argc, char *argv[]) {
-   struct soap soap;
-   int i, m, s; // master and slave sockets
-
-   glite_jp_context_t	ctx;
-
-   soap_init(&soap);
-   soap_set_namespaces(&soap, jpps__namespaces);
-
-   glite_jp_init_context(&ctx);
-
-   if (glite_jppsbe_init(ctx, &argc, argv)) {
-	   /* XXX log */
-	   fputs(glite_jp_error_chain(ctx), stderr);
-	   exit(1);
-   }
-
-   soap.user = (void *) ctx;
-
-   ctx->other_soap = soap_new();
-   soap_init(ctx->other_soap);
-   soap_set_namespaces(ctx->other_soap,jpis__namespaces);
-
-   srand48(time(NULL)); /* feed id generation */
-
-   m = soap_bind(&soap, NULL, 8901, 100);
-   if (m < 0)
-      soap_print_fault(&soap, stderr);
-   else
-   {
-      fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
-      for (i = 1; ; i++) {
-         s = soap_accept(&soap);
-         if (s < 0) {
-            soap_print_fault(&soap, stderr);
-            break;
-         }
-         jpps__serve(&soap); // process RPC request
-         soap_destroy(&soap); // clean up class instances
-         soap_end(&soap); // clean up everything and close socket
-	 glite_jp_run_deferred(ctx);
-      }
-   }
-   soap_done(&soap); // close master socket
-
-   return 0;
-}
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
diff --git a/org.glite.jp.primary/src/soap_ops.c b/org.glite.jp.primary/src/soap_ops.c
deleted file mode 100644
index d49d112..0000000
--- a/org.glite.jp.primary/src/soap_ops.c
+++ /dev/null
@@ -1,415 +0,0 @@
-#include 
-#include 
-#include 
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "feed.h"
-
-#include "jpps_H.h"
-/* #include "JobProvenancePS.nsmap" */
-#include "jpps_.nsmap" 
-
-#include "jptype_map.h"
-
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
-		const glite_jp_error_t *err)
-{
-	struct jptype__genericFault *ret = NULL;
-	if (err) {
-		ret = soap_malloc(soap,sizeof *ret);
-		memset(ret,0,sizeof *ret);
-		ret->code = err->code;
-		ret->source = soap_strdup(soap,err->source);
-		ret->text = soap_strdup(soap,strerror(err->code));
-		ret->description = soap_strdup(soap,err->desc);
-		ret->reason = jp2s_error(soap,err->reason);
-	}
-	return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
-	char	*et;
-	struct SOAP_ENV__Detail	*detail = soap_malloc(soap,sizeof *detail);
-	struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
-	f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
-	detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
-	detail->fault = f;
-#else
-	detail->value = f;
-#endif
-	detail->__any = NULL;
-
-	soap_receiver_fault(soap,"Oh, shit!",NULL);
-	if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
-	else soap->fault->detail = detail;
-}
-
-#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t	ctx = (glite_jp_context_t) ((soap)->user)
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RegisterJob(
-		struct soap *soap,
-		struct _jpelem__RegisterJob *in,
-		struct _jpelem__RegisterJobResponse *empty)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	glite_jp_attrval_t owner_val[2];
-
-	printf("%s %s %s\n",__FUNCTION__,in->job,in->owner);
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__RegisterJob,in->job,in->owner) ||
-		glite_jppsbe_register_job(ctx,in->job,in->owner))
-	{
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	owner_val[0].name = GLITE_JP_ATTR_OWNER;
-	owner_val[0].value = in->owner;
-	owner_val[0].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
-	owner_val[0].timestamp = time(NULL);
-	owner_val[0].origin_detail = NULL;
-	owner_val[1].name = NULL;
-
-/* XXX: errrors should be ingored but not silently */
-	glite_jpps_match_attr(ctx,in->job,owner_val); 
-
-	return SOAP_OK;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__StartUpload(
-		struct soap *soap,
-		struct _jpelem__StartUpload *in,
-		struct _jpelem__StartUploadResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*destination;
-	time_t	commit_before = in->commitBefore;
-	glite_jp_error_t	err;
-	glite_jpps_fplug_data_t	**pd = NULL;
-	int	i;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__StartUpload,NULL,NULL)) {
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	switch (glite_jpps_fplug_lookup(ctx,in->class_,&pd)) {
-		case ENOENT:
-			err.code = ENOENT;
-			err.source = __FUNCTION__;
-			err.desc = "unknown file class";
-			glite_jp_stack_error(ctx,&err);
-			err2fault(ctx,soap);
-			return SOAP_FAULT;
-		case 0: break;
-		default:
-			err2fault(ctx,soap);
-			return SOAP_FAULT;
-	}
-
-	for (i=0; pd[0]->uris[i] && strcmp(pd[0]->uris[i],in->class_); i++);
-	assert(pd[0]->uris[i]);
-
-	if (glite_jppsbe_start_upload(ctx,in->job,pd[0]->classes[i],in->name,in->contentType,
-				&destination,&commit_before))
-	{
-		err2fault(ctx,soap);
-		free(pd);
-		return SOAP_FAULT;
-	}
-
-	out->destination = soap_strdup(soap,destination);
-	free(destination);
-	out->commitBefore = commit_before;
-
-	free(pd);
-	return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__CommitUpload(
-		struct soap *soap,
-		struct _jpelem__CommitUpload *in,
-		struct _jpelem__CommitUploadResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*job,*class,*name;
-
-	job = class = name = NULL;
-	
-	if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__CommitUpload,NULL,NULL) ||
-		glite_jppsbe_commit_upload(ctx,in->destination))
-	{
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	/* XXX: should not fail when commit_upload was OK */
-	assert(glite_jppsbe_destination_info(ctx,in->destination,&job,&class,&name) == 0);
-
-	/* XXX: ignore errors but don't fail silenty */
-	glite_jpps_match_file(ctx,job,class,name);
-
-	free(job); free(class); free(name);
-
-	return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag(
-		struct soap *soap,
-		struct _jpelem__RecordTag *in,
-		struct _jpelem__RecordTagResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	void	*file_be,*file_p;
-	glite_jpps_fplug_data_t	**pd = NULL;
-	glite_jp_attrval_t	attr[2];
-
-	file_be = file_p = NULL;
-
-	/* XXX: we assume just one plugin and also that TAGS plugin handles
-	 * just one uri/class */
-
-	if (glite_jpps_fplug_lookup(ctx,GLITE_JP_FILETYPE_TAGS,&pd)
-		|| glite_jppsbe_open_file(ctx,in->jobid,pd[0]->classes[0],NULL,
-						O_RDWR|O_CREAT,&file_be)
-			/* XXX: tags need reading to check magic number */
-	) {
-		free(pd);
-		err2fault(ctx,soap);
-		return SOAP_FAULT;
-	}
-
-	/* XXX: assuming tag plugin handles just one type */
-	if (pd[0]->ops.open(pd[0]->fpctx,file_be,GLITE_JP_FILETYPE_TAGS,&file_p)
-		|| pd[0]->ops.generic(pd[0]->fpctx,file_p,GLITE_JP_FPLUG_TAGS_APPEND,in->tag->name,in->tag->value))
-	{
-		err2fault(ctx,soap);
-		if (file_p) pd[0]->ops.close(pd[0]->fpctx,file_p);
-		glite_jppsbe_close_file(ctx,file_be);
-		free(pd);
-		return SOAP_FAULT;
-	}
-
-	if (pd[0]->ops.close(pd[0]->fpctx,file_p)
-		|| glite_jppsbe_close_file(ctx,file_be))
-	{
-		err2fault(ctx,soap);
-		free(pd);
-		return SOAP_FAULT;
-	}
-
-	attr[0].name = in->tag->name;
-	attr[0].value = in->tag->value;
-	attr[0].origin = GLITE_JP_ATTR_ORIG_USER;
-	attr[0].timestamp = time(NULL);
-	attr[0].origin_detail = NULL; 	/* XXX */
-
-	/* XXX: ignore errors but don't fail silenty */
-	glite_jpps_match_attr(ctx,in->jobid,attr);
-
-	free(pd);
-	return SOAP_OK;
-}
-
-static void s2jp_qval(const struct jptype__stringOrBlob *in, char **value, int *binary, size_t *size)
-{
-	if (in->string) {
-		*value = in->string;
-		*binary = 0;
-		*size = 0;
-	}
-	else {
-		assert(in->blob);	/* XXX: should report error instead */
-		*value = in->blob->__ptr;
-		*binary = 1;
-		*size = in->blob->__size;
-	}
-}
-
-static void s2jp_query(const struct jptype__primaryQuery *in, glite_jp_query_rec_t *out)
-{
-	int	b;
-
-	out->attr = in->attr;
-
-	s2jp_qval(in->value,&out->value,&out->binary,&out->size);
-	switch (in->op) {
-		case EQUAL: out->op = GLITE_JP_QUERYOP_EQUAL; break;
-		case UNEQUAL: out->op = GLITE_JP_QUERYOP_UNEQUAL; break;
-		case LESS: out->op = GLITE_JP_QUERYOP_LESS; break;
-		case GREATER: out->op = GLITE_JP_QUERYOP_GREATER; break;
-		case WITHIN:
-			out->op = GLITE_JP_QUERYOP_WITHIN;
-			s2jp_qval(in->value2,&out->value2,&b,&out->size2);
-			assert(out->binary == b);	/* XXX: report error instead */
-
-			break;
-	}
-
-	if (in->origin) switch (*in->origin) {
-		case jptype__attrOrig__SYSTEM: out->origin = GLITE_JP_ATTR_ORIG_SYSTEM; break;
-		case jptype__attrOrig__USER: out->origin = GLITE_JP_ATTR_ORIG_USER; break;
-		case jptype__attrOrig__FILE_: out->origin = GLITE_JP_ATTR_ORIG_FILE; break;
-	}
-	else out->origin = GLITE_JP_ATTR_ORIG_ANY;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex(
-		struct soap *soap,
-		struct _jpelem__FeedIndex *in,
-		struct _jpelem__FeedIndexResponse *out)
-{	
-
-/* deferred processing: return feed_id to the index server first,
- * start feeding it afterwards -- not before the index server actually
- * knows feed_id and is ready to accept the feed.
- *
- * Has to be done within the same server slave, 
- * passed through the context */
-
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*feed_id = NULL;
-	time_t	expires = 0;
-	int 	ret = SOAP_OK;
-
-	char	const **attrs = calloc(in->__sizeattributes+1,sizeof *attrs);
-	glite_jp_query_rec_t	*qry = calloc(in->__sizeconditions+1,sizeof *qry);
-	int	i;
-
-	glite_jp_clear_error(ctx);
-
-	memcpy(attrs,in->attributes,sizeof *attrs * in->__sizeattributes);
-	for (i = 0; i__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);
-
-	if (in->history) {
-		if (glite_jpps_run_feed(ctx,in->destination,attrs,qry,&feed_id)) {
-			err2fault(ctx,soap);
-			ret = SOAP_FAULT;
-			goto cleanup;
-		}
-	}
-
-	if (in->continuous) {
-		if (glite_jpps_register_feed(ctx,in->destination,attrs,qry,&feed_id,&expires)) {
-			err2fault(ctx,soap);
-			ret = SOAP_FAULT;
-			goto cleanup;
-		}
-	}
-
-	if (!in->history && !in->continuous) {
-		glite_jp_error_t	err;
-		memset(&err,0,sizeof err);
-		err.code = EINVAL;
-		err.source = __FUNCTION__;
-		err.desc = "at least one of  and  must be true";
-		glite_jp_stack_error(ctx,&err);
-		err2fault(ctx,soap);
-		ret = SOAP_FAULT;
-		goto cleanup;
-	}
-
-	out->feedExpires = expires;
-	out->feedId = soap_strdup(soap,feed_id);
-
-cleanup:
-	free(feed_id);
-	free(attrs);
-	free(qry);
-
-	return ret;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndexRefresh(
-		struct soap *soap,
-		struct _jpelem__FeedIndexRefresh *in,
-		struct _jpelem__FeedIndexRefreshResponse *out)
-{
-	fprintf(stderr,"%s: not implemented\n",__FUNCTION__);
-	abort();
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
-		struct soap *soap,
-		struct _jpelem__GetJobFiles *in,
-		struct _jpelem__GetJobFilesResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-	char	*url;
-
-	int	i,n;
-	glite_jp_error_t	err;
-	void	**pd;
-	struct jptype__jppsFile 	**f = NULL;
-
-	memset(&err,0,sizeof err);
-	out->__sizefiles = 0;
-
-	for (pd = ctx->plugins; *pd; pd++) {
-		glite_jpps_fplug_data_t	*plugin = *pd;
-
-		for (i=0; plugin->uris[i]; i++) {
-			glite_jp_clear_error(ctx);
-			switch (glite_jppsbe_get_job_url(ctx,in->jobid,plugin->classes[i],NULL,&url)) {
-				case 0: n = out->__sizefiles++;
-					f = realloc(f,out->__sizefiles * sizeof *f);
-					f[n] = soap_malloc(soap, sizeof **f);
-					f[n]->class_ = soap_strdup(soap,plugin->uris[i]);
-					f[n]->name = NULL;
-					f[n]->url = soap_strdup(soap,url);
-					free(url);
-					break;
-				case ENOENT:
-					break;
-				default: 
-					err.code = ctx->error->code;
-					err.source = "jpsrv__GetJob()";
-					err.desc = plugin->uris[i];
-					glite_jp_stack_error(ctx,&err);
-					err2fault(ctx,soap);
-					glite_jp_clear_error(ctx);
-					return SOAP_FAULT;
-			}
-		}
-	}
-
-	if (!out->__sizefiles) {
-		glite_jp_clear_error(ctx);
-		err.code = ENOENT;
-		err.source = __FUNCTION__;
-		err.desc = "No file found for this job";
-		glite_jp_stack_error(ctx,&err);
-		err2fault(ctx,soap);
-//		glite_jp_clear_error(ctx);
-		return SOAP_FAULT;
-	}
-
-	out->files = soap_malloc(soap,out->__sizefiles * sizeof *f);
-	memcpy(out->files,f,out->__sizefiles * sizeof *f);
-
-	return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobAttributes(
-		struct soap *soap,
-		struct _jpelem__GetJobAttributes *in,
-		struct _jpelem__GetJobAttributesResponse *out)
-{
-	CONTEXT_FROM_SOAP(soap,ctx);
-
-	/* TODO */
-	abort();
-}
diff --git a/org.glite.jp.primary/src/tags.c b/org.glite.jp.primary/src/tags.c
deleted file mode 100644
index 1f11b4d..0000000
--- a/org.glite.jp.primary/src/tags.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include "tags.h"
-#include "backend.h"
-
-/* magic name_len value_len binary sequence timestamp */
-#define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#"
-#define HEADER_SIZE 48
-
-int glite_jpps_tag_append(
-	glite_jp_context_t ctx,
-	void *handle,
-	const glite_jp_tagval_t *tag
-)
-{
-	char	hdr[HEADER_SIZE+1];
-	glite_jp_error_t	err;
-
-	unsigned long	vlen = tag->binary ? tag->size :
-				(tag->value ? strlen(tag->value) : 0);
-	int	nlen;
-
-	memset(&err,0,sizeof err);
-	err.source = "glite_jpps_tag_append()";
-
-	if (!tag->name) {
-		err.code = EINVAL;
-		err.desc = "tag name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	nlen = strlen(tag->name);
-
-	assert(sprintf(hdr,HEADER,nlen,vlen,
-			tag->binary ? "B" : "S",
-			tag->sequence, tag->timestamp) == HEADER_SIZE);
-
-	if (glite_jppsbe_append(ctx,handle,hdr,HEADER_SIZE)) {
-		err.code = EIO;
-		err.desc = "write tag header";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jppsbe_append(ctx,handle,tag->name,nlen)) {
-		err.code = EIO;
-		err.desc = "write tag name";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (glite_jppsbe_append(ctx,handle,tag->value,vlen)) {
-		err.code = EIO;
-		err.desc = "write tag value";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	return 0;
-}
-
-int glite_jpps_tagval_copy(
-	glite_jp_context_t ctx,
-	glite_jp_tagval_t *from,
-	glite_jp_tagval_t *to
-)
-{
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	to->name = strdup(from->name);
-	if (!to->name) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	to->sequence = from->sequence;
-	to->timestamp = from->timestamp;
-	to->binary = from->binary;
-	to->size = from->size;
-	to->value = (char *) malloc(to->size);
-	if (!to->value) {
-		free(to->name);
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	memcpy(from->value, to->value, to->size);
-
-	return 0;
-}
-
-int glite_jpps_tag_read(
-	glite_jp_context_t ctx,
-	void *handle,
-	off_t offset,
-	glite_jp_tagval_t *tagvalue,
-	size_t *shift
-)
-{
-	char hdr[HEADER_SIZE+1];
-	unsigned int nlen;
-	unsigned long  vlen;
-	char binary;
-	unsigned sequence;
-	unsigned timestamp;
-	char * name = NULL;
-	char * value = NULL;
-	ssize_t ret;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	hdr[HEADER_SIZE] = '\0';
-	if (glite_jppsbe_pread(ctx, handle, hdr, HEADER_SIZE, offset, &ret)) {
-		err.code = EIO;
-		err.desc = "Cannot read tag header";
-		goto error_out;
-	}
-	if (ret == 0) {
-		err.code = ENOENT;
-		err.desc = "No more tags in the file";
-		goto error_out;
-	}
-	/* #define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#" */
-	if (sscanf(hdr, HEADER, &nlen, &vlen, &binary, &sequence, ×tamp) < 5) {
-		err.code = EILSEQ;
-		err.desc = "Incorrect tag header format";
-		goto error_out;
-	}
-	name = (char*) malloc(nlen + 1);
-	if (!name) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	name[nlen] = '\0';
-	value = (char*) malloc(vlen + 1);
-	if (!value) {
-		err.code = ENOMEM;
-		goto error_out;
-	}
-	value[vlen] = '\0';
-	if (glite_jppsbe_pread(ctx, handle, name, nlen, offset + HEADER_SIZE, &ret)) {
-		err.code = EIO;
-		err.desc = "Cannot read tag name";
-		goto error_out;
-	}
-	if (glite_jppsbe_pread(ctx, handle, value, vlen, offset + HEADER_SIZE + nlen, &ret)) {
-		err.code = EIO;
-		err.desc = "Cannot read tag value";
-		goto error_out;
-	}
-	
-	tagvalue->name = name;
-	tagvalue->sequence = sequence;
-	tagvalue->timestamp = timestamp;
-	tagvalue->binary = (binary == 'B') ? 1 : 0;
-	tagvalue->size = vlen;
-	tagvalue->value = value;
-
-	*shift = HEADER_SIZE + nlen + vlen;
-
-	return 0;
-error_out:
-	free(name);
-	free(value);
-	return glite_jp_stack_error(ctx,&err);
-}
-
-/*
-int glite_jpps_tag_read(glite_jp_context_t, void *, off_t, glite_jp_tagval_t *, size_t);
-int glite_jpps_tag_readall(glite_jp_context_t, void *, glite_jp_tagval_t **);
-*/
-
-int glite_jpps_tag_readall(
-	glite_jp_context_t ctx,
-	void *handle,
-	glite_jp_tagval_t **tags_out
-)
-{
-	glite_jp_tagval_t * tags = NULL;
-	void * newspace;
-	int ntags = 0;
-	int ntagspace = 0;
-	off_t offset = 0;
-	int ret;
-	size_t shift;
-	glite_jp_error_t err;
-
-	glite_jp_clear_error(ctx);
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-
-	ntagspace = 1;
-	tags = (glite_jp_tagval_t *) calloc(ntagspace + 1, sizeof(*tags));
-	if (!tags) {
-		err.code = ENOMEM;
-		return glite_jp_stack_error(ctx,&err);
-	}
-	while (!(ret = glite_jpps_tag_read(ctx, handle, offset, &tags[ntags], &shift))) {
-		offset += shift;
-		ntags++;
-		if (ntagspace <= ntags) {
-			ntagspace += 1;
-			newspace = realloc(tags, (ntagspace + 1) * sizeof(*tags));
-			if (!newspace) {
-				err.code = ENOMEM;
-				goto error_out;
-			}
-			tags = (glite_jp_tagval_t *) newspace;
-		}
-	}
-	if (ret == ENOENT) {
-		*tags_out = tags;
-		return 0;
-	} else {
-		err.code = EIO;
-		err.desc = "Error reading tag value";
-	}
-
-error_out:
-	for (; ntags-- ;) {
-		free(tags[ntags].name);
-		free(tags[ntags].value);
-	}
-	free(tags);
-	return glite_jp_stack_error(ctx,&err);
-}
diff --git a/org.glite.jp.primary/src/tags.h b/org.glite.jp.primary/src/tags.h
deleted file mode 100644
index 3aade74..0000000
--- a/org.glite.jp.primary/src/tags.h
+++ /dev/null
@@ -1 +0,0 @@
-int glite_jpps_tag_append(glite_jp_context_t,void *,const char *, const char *);
diff --git a/org.glite.jp.primary/src/tags_plugin.c b/org.glite.jp.primary/src/tags_plugin.c
deleted file mode 100644
index 877201d..0000000
--- a/org.glite.jp.primary/src/tags_plugin.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-#include "backend.h"
-
-static int tagappend(void *,void *,int,...);
-static int tagopen(void *,void *,const char *uri,void **);
-static int tagclose(void *,void *);
-
-#define TAGS_MAGIC 0x74c016f2	/* two middle digits encode version, i.e. 01 */
-
-static int tagdummy()
-{
-	puts("tagdummy()");
-	return -1;
-}
-
-struct tags_handle {
-	void	*bhandle;
-	int	n;
-	glite_jp_tagval_t	*tags;
-};
-
-int init(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data)
-{
-	data->fpctx = ctx;
-
-	data->uris = calloc(2,sizeof *data->uris);
-	data->uris[0] = strdup(GLITE_JP_FILETYPE_TAGS);
-
-	data->classes = calloc(2,sizeof *data->classes);
-	data->classes[0] = strdup("tags");
-
-	data->ops.open = tagopen;
-	data->ops.close = tagclose;
-	data->ops.attr = tagdummy;
-	data->ops.generic = tagappend;
-	
-	printf("tags_plugin: URI: \"%s\"; magic number: 0x%08lx\n",GLITE_JP_FILETYPE_TAGS,TAGS_MAGIC);
-	return 0;
-}
-
-static int tagopen(void *fpctx,void *bhandle,const char *uri,void **handle)
-{
-	struct tags_handle *h = calloc(1,sizeof *h);
-	h->n = -1;
-	h->bhandle = bhandle;
-
-	*handle = h;
-
-	return 0;
-}
-
-static int tagclose(void *fpctx,void *handle)
-{
-	int	i;
-	struct tags_handle *h = handle;
-
-	for (i=0; in; i++) {
-		free(h->tags[i].name);
-		free(h->tags[i].value);
-	}
-	free(h->tags);
-	free(h);
-
-	return 0;
-}
-
-static int tagappend(void *fpctx,void *handle,int oper,...)
-{
-	glite_jp_tagval_t	*tag;
-	va_list	ap;
-	char	*hdr,*rec;
-	glite_jp_context_t	ctx = fpctx;
-	struct tags_handle	*h = handle;
-	uint32_t		magic,hlen,rlen,rlen_n;
-	size_t			r;
-	glite_jp_error_t	err;
-
-	memset(&err,0,sizeof err);
-	err.source = __FUNCTION__;
-	glite_jp_clear_error(ctx);
-
-	va_start(ap,oper);
-	tag = va_arg(ap,glite_jp_tagval_t *);
-	va_end(ap);
-
-	printf("tagappend: %s,%d,%s\n",tag->name,tag->sequence,tag->value);
-
-	assert(oper == GLITE_JP_FPLUG_TAGS_APPEND);
-
-	if (glite_jppsbe_pread(ctx,h->bhandle,&magic,sizeof magic,0,&r)) {
-		err.code = EIO;
-		err.desc = "reading magic number";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	if (r == 0) {
-		magic = htonl(TAGS_MAGIC);
-		if (glite_jppsbe_pwrite(ctx,h->bhandle,&magic,sizeof magic,0)) {
-			err.code = EIO;
-			err.desc = "writing magic number";
-			return glite_jp_stack_error(ctx,&err);
-		}
-	}
-	else if (r != sizeof magic) {
-		err.code = EIO;
-		err.desc = "can't read magic number";
-		return glite_jp_stack_error(ctx,&err);
-	}
-	else if (magic != htonl(TAGS_MAGIC)) {
-		err.code = EINVAL;
-		err.desc = "invalid magic number";
-		return glite_jp_stack_error(ctx,&err);
-	}
-
-	trio_asprintf(&hdr,"%d %ld %c",tag->sequence,
-			tag->timestamp,tag->binary ? 'B' : 'S');
-
-	rlen = strlen(tag->name) + strlen(hdr) + 2 /* \0 after name and after hdr */ +
-		(r = tag->binary ? tag->size : (tag->value ? strlen(tag->value) : 0));
-
-	rlen_n = htonl(rlen);
-
-	rec = malloc(rlen + sizeof rlen_n);
-	*((uint32_t *) rec) = rlen_n;
-	strcpy(rec + sizeof rlen_n,tag->name);
-	strcpy(rec + (hlen = sizeof rlen_n + strlen(tag->name) + 1),hdr);
-
-	if (r) memcpy(rec + hlen + strlen(hdr) + 1,tag->value,r);
-	free(hdr);
-
-	if (glite_jppsbe_append(ctx,h->bhandle,rec,rlen + sizeof rlen_n)) {
-		err.code = EIO;
-		err.desc = "writing tag record";
-		free(rec);
-		return glite_jp_stack_error(ctx,&err);
-	}
-	
-	return 0;
-}
diff --git a/org.glite.jp.primary/src/typemap.dat b/org.glite.jp.primary/src/typemap.dat
deleted file mode 100644
index 72f515f..0000000
--- a/org.glite.jp.primary/src/typemap.dat
+++ /dev/null
@@ -1,3 +0,0 @@
-jpsrv = http://glite.org/wsdl/services/jp
-jptype = http://glite.org/wsdl/types/jp
-jpelem = http://glite.org/wsdl/elements/jp
diff --git a/org.glite.jp.ws-interface/.cvsignore b/org.glite.jp.ws-interface/.cvsignore
deleted file mode 100755
index 1df717b..0000000
--- a/org.glite.jp.ws-interface/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.project
-.cdtproject
\ No newline at end of file
diff --git a/org.glite.jp.ws-interface/LICENSE b/org.glite.jp.ws-interface/LICENSE
deleted file mode 100755
index 01b973b..0000000
--- a/org.glite.jp.ws-interface/LICENSE
+++ /dev/null
@@ -1,69 +0,0 @@
-LICENSE file for EGEE Middleware
-================================
-
-Copyright (c) 2004 on behalf of the EU EGEE Project: 
-The European Organization for Nuclear Research (CERN), 
-Istituto Nazionale di Fisica Nucleare (INFN), Italy
-Datamat Spa, Italy
-Centre National de la Recherche Scientifique (CNRS), France
-CS Systeme d'Information (CSSI), France
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-Universiteit van Amsterdam (UvA), Netherlands
-University of Helsinki (UH.HIP), Finlan
-University of Bergen (UiB), Norway
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
-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. The end-user documentation included with the redistribution, if
-any, must include the following acknowledgment: "This product includes
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."
-Alternatively, this acknowledgment may appear in the software itself, if
-and wherever such third-party acknowledgments normally appear.
-
-4. The names EGEE and the EU EGEE Project must not be
-used to endorse or promote products derived from this software without
-prior written permission. For written permission, please contact
-.
-
-5. You are under no obligation whatsoever to provide anyone with any
-bug fixes, patches, or upgrades to the features, functionality or
-performance of the Software ("Enhancements") that you may develop over
-time; however, if you choose to provide your Enhancements to The EU
-EGEE Project, or if you choose to otherwise publish or distribute your
-Enhancements, in source code form without contemporaneously requiring
-end users of The EU EGEE Proejct to enter into a separate written license
-agreement for such Enhancements, then you hereby grant The EU EGEE Project
-a non-exclusive, royalty-free perpetual license to install, use, copy,
-modify, prepare derivative works, incorporate into the EGEE Middleware
-or any other computer software, distribute, and sublicense your
-Enhancements or derivative works thereof, in binary and source code
-form (if any), whether developed by The EU EGEE Project or third parties.
-
-THIS SOFTWARE IS PROVIDED "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 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 software consists of voluntary contributions made by many
-individuals on behalf of the EU EGEE Prject. For more information on The
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/
-
-
diff --git a/org.glite.jp.ws-interface/Makefile b/org.glite.jp.ws-interface/Makefile
deleted file mode 100644
index ee80ab4..0000000
--- a/org.glite.jp.ws-interface/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-# Default values
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-package=glite-jp-ws-interface
-version=0.0.0
-PREFIX=/opt/glite
-
--include Makefile.inc
-
-VPATH=${top_srcdir}/interface:${top_srcdir}/src
-STAGETO=interface
-
-XSLTPROC=xsltproc
-XMLLINT:=xmllint
-docbookxls:=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
-
-#WSDL=JobProvenancePS.wsdl JobProvenanceIS.wsdl JobProvenanceTypes.wsdl 
-WSDL=JobProvenancePS.wsdl JobProvenanceTypes.wsdl 
-
-all compile: ${WSDL}
-
-check: 
-	@echo No unit test required for interface-only module.
-
-stage: ${WSDL}
-	$(MAKE) install PREFIX=${stagedir}
-
-dist: distsrc distbin
-
-distsrc:
-	mkdir -p ${top_srcdir}/${package}-${version}
-	cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
-	cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
-	rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
-	$(MAKE) install PREFIX=${top_srcdir}/tmpbuilddir
-	cd ${top_srcdir}/tmpbuilddir && tar -czf ${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *
-	rm -rf ${top_srcdir}/tmpbuilddir
-	
-install:
-	-mkdir -p ${PREFIX}/${STAGETO}
-	-mkdir -p ${PREFIX}/share/doc/${package}-${version}
-	install -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
-#	cd ${top_srcdir}/interface && install -m 644 ${WSDL} ${PREFIX}/${STAGETO}
-	install -m 644 ${WSDL} ${PREFIX}/${STAGETO}
-
-clean:
-	rm -f *.h
-	
-%.wsdl: %.xml
-	${XSLTPROC} ../src/puke-wsdl.xsl $< >$@
-
-JobProvenancePS.html: doc.xml JobProvenancePS.xml JobProvenanceTypes.xml puke-ug.xsl
-	${XSLTPROC} --novalid ../src/puke-ug.xsl $< >doc-html.xml
-	${XMLLINT} --valid --noout doc-html.xml
-	${XSLTPROC} --stringparam  chapter.autolabel 0 ${docbookxls} doc-html.xml >$@
diff --git a/org.glite.jp.ws-interface/build.xml b/org.glite.jp.ws-interface/build.xml
deleted file mode 100644
index ae5d49b..0000000
--- a/org.glite.jp.ws-interface/build.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-	
-	
-	
-	
-	
-	
-		 
-	
-	
-	 
-
-	
-	 
-	
- 		
diff --git a/org.glite.jp.ws-interface/interface/JobProvenanceIS.wsdl b/org.glite.jp.ws-interface/interface/JobProvenanceIS.wsdl
deleted file mode 100644
index 84c8844..0000000
--- a/org.glite.jp.ws-interface/interface/JobProvenanceIS.wsdl
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-	
-		 
-
-	
-		 
-
-	
-		 
-		
-	
-		 
-	
-		
-			Store or update information on jobs within the JP index server.
-Called directly by the primary storage, used for both batch and incremental feed.
-
-Input:
-
-data: list of job record updates. Each contains jobid, list of JP attribute values and user tag values.
-
-feedDone: flag indicating end of batch feed. (In order to avoid potential problems with buffer allocation
-the huge dataset of batch feed is split into reasonable chunks and delivered with more UpdateJobs calls.)
-
-Output: N/A
-
-Faults: GenericJPFault
-
-
-			 
-			 
-		
-			Retrieve pointers to job records of jobs matching a query.
-Input: conditions - list of lists of query conditions.
-	Elements of the inner lists refer to a single job attribute, the conditions are or-ed.
-	Elements of the outer list may refer to different job attributes, they are and-ed.
-
-Output:
-
-jobs: list of JobId, PSContact (URL of the primary storage which manges this job) pairs
-
-Faults: GenericJPFault
-			 
-			 
-	 
-
-	
-		
-			
-				 
-			
-				 
-		 
-		
-			
-				 
-			
-				 
-		 
-	 
-
-	
-		Job Provenance Index service 
-		
-			 
-	 
-		
-
- 
diff --git a/org.glite.jp.ws-interface/project/build.number b/org.glite.jp.ws-interface/project/build.number
deleted file mode 100644
index 63f5995..0000000
--- a/org.glite.jp.ws-interface/project/build.number
+++ /dev/null
@@ -1 +0,0 @@
-module.build=33
diff --git a/org.glite.jp.ws-interface/project/build.properties b/org.glite.jp.ws-interface/project/build.properties
deleted file mode 100755
index e69de29..0000000
diff --git a/org.glite.jp.ws-interface/project/configure.properties.xml b/org.glite.jp.ws-interface/project/configure.properties.xml
deleted file mode 100644
index 4b08208..0000000
--- a/org.glite.jp.ws-interface/project/configure.properties.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-	
-		 
-	
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-jpprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-                 
-     
- 
diff --git a/org.glite.jp.ws-interface/project/glite-jp-ws-interface.spec b/org.glite.jp.ws-interface/project/glite-jp-ws-interface.spec
deleted file mode 100644
index dba6d55..0000000
--- a/org.glite.jp.ws-interface/project/glite-jp-ws-interface.spec
+++ /dev/null
@@ -1,42 +0,0 @@
-Summary:Change me !!!
-Name:glite-jp-ws-interface
-Version:0.0.0
-Release:0
-Copyright:Open Source EGEE License
-Vendor:EU EGEE project
-Group:System/Application
-Prefix:/opt/glite
-BuildArch:x86_64
-BuildRoot:%{_builddir}/%{name}-%{version}
-Source:glite-jp-ws-interface-0.0.0_bin.tar.gz
-
-%define debug_package %{nil}
-
-%description
-Change me !!!
-
-%prep
- 
-
-%setup -c
-
-%build
- 
-
-%install
- 
-
-%clean
- 
-%pre
-%post
-%preun
-%postun
-%files
-%defattr(-,root,root)
-%{prefix}/interface/JobProvenancePS.wsdl
-%{prefix}/interface/JobProvenanceTypes.wsdl
-%{prefix}/share/doc/glite-jp-ws-interface-0.0.0/LICENSE
-
-%changelog
-
diff --git a/org.glite.jp.ws-interface/project/properties.xml b/org.glite.jp.ws-interface/project/properties.xml
deleted file mode 100644
index 4ec8018..0000000
--- a/org.glite.jp.ws-interface/project/properties.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-	
-	 
diff --git a/org.glite.jp.ws-interface/project/tar_exclude b/org.glite.jp.ws-interface/project/tar_exclude
deleted file mode 100644
index e69de29..0000000
diff --git a/org.glite.jp.ws-interface/project/version.properties b/org.glite.jp.ws-interface/project/version.properties
deleted file mode 100755
index 0ff5227..0000000
--- a/org.glite.jp.ws-interface/project/version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-module.version=1.0.0
-module.age=0
diff --git a/org.glite.jp.ws-interface/src/JobProvenancePS.xml b/org.glite.jp.ws-interface/src/JobProvenancePS.xml
deleted file mode 100644
index c4cb810..0000000
--- a/org.glite.jp.ws-interface/src/JobProvenancePS.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-	CVS revision:  
-
-	
-		
-		The Job Provenance (JP) Primary Storage Service is responsible
-		to keep the JP data
-		(definition of submitted jobs, execution conditions and environment,
-		and important points of the job life cycle) in a compact and
-		economic form.
-		 
-
-		
-		The JP Primary storage, as described in section 8.4 of
-		the 
-		
-		Architecture deliverable DJRA1.1 
-		 
-		provides public interfaces for data storing,
-		retrieval based on basic metadata, and registration of Index servers for
-		incremental feed.
-		 
-
-		
-		Command interface to JP is completely covered by the WS interface covered here.
-		Bulk file transfers are done via specialised protocols, currently gsiftp only.
-		 
-	 
-
-	
-		
-			Register job with the JP primary storage.
-			Any error. 
-		 
-	
-		
-			Start uploading a file.
-			URL where the client should upload the file. 
-			Server's view on when the upload must be finished. 
-			Any error. 
-		 
-	
-		
-			Confirm a successfully finished file apload.
-			Any error. 
-		 
-	
-		
-			Record an additional user tag.
-			Any error. 
-		 
-	
-		
-			Request for feeding a JP Index server (issued by this server).
-			Unique ID of the created feed session. 
-			When the session expires. 
-			Any error. 
-		 
-	
-		
-			Refresh an existing feed session.
-			New session expiration time. 
-			Any error. 
-		 
-	
-		
-			Return URL's of files for a given single job.
-			List of the stored files. 
-			Any error. 
-		 
-
-		
-			Query concrete attributes of a given job.
-			Values of the queried attributes. 
-			Any error. 
-		 
-	 
-
- 
diff --git a/org.glite.jp.ws-interface/src/JobProvenanceTypes.xml b/org.glite.jp.ws-interface/src/JobProvenanceTypes.xml
deleted file mode 100644
index 49d3bf6..0000000
--- a/org.glite.jp.ws-interface/src/JobProvenanceTypes.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-	CVS revision:  
-
-	
-
-		
-			Operators used in queries. Most are self-explanatory.
-			The attribute is between two specified values. 
-		 
-
-		
-			A single user-recorded value for a job attribute.
-			Name of the attribute, including namespace. 
-			Value - printable string. 
-		 
-	
-		
-			 
-	
-		
-			A single condition on job.
-			Attribute name to query. 
-			Operation. 
-			Where the attribute value came from. 
-			Value to compare the job attribute with. 
-			Another value (for op = WITHIN). 
-		 
-
-		
-			JP primary storage file identification.
-			Type of the file (as set on StartUpload). 
-			Name of the file (if there are more of the same type per job). 
-			Where the file is stored on JP primary storage. 
-		 
-
-		
-			Single value of an attribute.
-			Name of the attribute, including namespace. 
-			String value. 
-			When this value was recorded. 
-			Where this value came from. 
-			 
-
-		
-			String value. 
-			Binary value. 
-		 
-
-		
-			Specification of attribute origin.
-			JP system value, e.g. job owner. 
-			Explicitely stored by the user via RecordTag operation. 
-			Coming from uploaded file. 
-		 
-	
-		
- 
-
- 
-
diff --git a/org.glite.jp.ws-interface/src/doc.xml b/org.glite.jp.ws-interface/src/doc.xml
deleted file mode 100644
index 78cb6a5..0000000
--- a/org.glite.jp.ws-interface/src/doc.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
-
-
-	
-		
-			Overview 
-			 
-
-		
-			Operations 
-			  
-				
-				
-					 
-		 
-	
-		
-			Types 
-			
-			  
-			 
-	 
- 
-
-
-
-	
-		
-			
-				list of  
-				
-					
-						 
-					 
-			
-			  
-		 
-		
-			 
-	 
- 
-
-
-	
-		
-			Inputs:
-			
-				
-					
-						 
-				 
-				N/A 
-			 
-		 
-		
-			Outputs:
-			
-				
-					
-				 
-				 
-				N/A 
-			 
-		 
-	 
- 
-
-
-	
-		
-			  
-			  
-			
-				
-					 Structure  (sequence complex type in WSDL) 
-					 Fields: ( type   name  description ) 
-				 
-				
-					 Union  (choice complex type in WSDL) 
-					 Fields: ( type   name  description ) 
-				 
-				
-					 Enumeration  (restriction of xsd:string in WSDL),
-						exactly one of the values must be specified.
-					 
-					 Values:  
-				 
-				
-					 Flags  (sequence of restricted xsd:string in WSDL),
-						any number of values can be specified together.
-					 
-					 Values:  
-				 
-			 
-			
-				
-					
-						
-							
-								
-										list of  
-										
-											
-												 
-											 
-									
-									 
-								
-									 
-							 
-						 
-						
-							
-								 (optional)  
-								
-								 
-						 
-					 
-				 
-			 
-		 
-	 
- 
-
-
- 
diff --git a/org.glite.jp.ws-interface/src/puke-wsdl.xsl b/org.glite.jp.ws-interface/src/puke-wsdl.xsl
deleted file mode 100644
index ea7598e..0000000
--- a/org.glite.jp.ws-interface/src/puke-wsdl.xsl
+++ /dev/null
@@ -1,292 +0,0 @@
-
-
-
-
-
-	
-  	
-			 
-
-		 
- 
-
-
-	
-		
-
-			 
-	 
-	
- 
-
-
-
-
-	
-		
-			 
-	 
-
- 
-
-
-	
-		
-			 
-	 
-	
-		
-			 
-	 
-
- 
-
-
-	
-		
-			 
-	 
- 
-
-
-	
-		
-			 
-	 
- 
-
-
-
-	
-		
-			true 
-			false 
-		 
-	 
-			
-				
-					
-						
-							 
-						
-							 
-					 
-				 
-				
-					
-						0 
-						1 
-					 
-				 
-				
-					
-						unbounded 
-						1 
-					 
-				 
-				 
-
- 
-
-
-	
-		
-			 
-	 
-	
-		
-			 
-	 
- 
-
-
-	
-		
-			
-				
-					
-						
-							 
-					 
-					
-						
-							unbounded 
-							1 
-						 
-					 
-					 
-			 
-		 
-	 
-	
-		
-			
-				
-					
-						
-							 
-					 
-					
-						
-							unbounded 
-							1 
-						 
-					 
-					 
-			 
-		 
-	 
- 
-
-
-
-	
-		
-			 
-	 
- 
-
-
-	
-		 
- 
-
-
-	
-		
-			 
-		
-			 
-		
-			 
-	 
- 
-
-
-	 
-
-
-	
-		
-
-			
-				 
-		 
-	 
-
-		
-			 
-
-		
-			 
-
-		
-			
-				 
-
-		 
-
- 
-
-
-	
-		 
- 
-
-
- 
-
diff --git a/org.glite.jp/.cvsignore b/org.glite.jp/.cvsignore
deleted file mode 100644
index 3a4edf6..0000000
--- a/org.glite.jp/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-.project
diff --git a/org.glite.jp/build.xml b/org.glite.jp/build.xml
deleted file mode 100644
index f51954b..0000000
--- a/org.glite.jp/build.xml
+++ /dev/null
@@ -1,268 +0,0 @@
-
-
-
-
-
-	
-		Ant build file to build the GLite Job Provenance Subsystem
-	 
-		
-	
-
-	
-	
-
-		 Preparing directories ...  
-		
-		 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-		
-			 
-	 
-
-	
-
-		
-			 
-
-		 
-
-	
-		
-			
-				
-					 
-			 
-			
-				 
-		 
-	 
-
-	
-		
-			
-				
-					 
-			 
-			
-				 
-		 
-	 
-
-	
-		
-			
-				
-					 
-			 
-			
-				 
-		 
-	 
-
-	
-		
-			
-				
-					 
-			 
-			
-				 
-		 
-	 
-
-	
-	
-		
-	<project name="${subsystem.name}" type="post-subsystem" packageName="${global.prefix}-${subsystem.prefix}"/>
-		 
-	 
-
- 
diff --git a/org.glite.jp/project/build.number b/org.glite.jp/project/build.number
deleted file mode 100644
index c680c72..0000000
--- a/org.glite.jp/project/build.number
+++ /dev/null
@@ -1 +0,0 @@
-module.build=36
diff --git a/org.glite.jp/project/build.properties b/org.glite.jp/project/build.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/org.glite.jp/project/dependencies.properties b/org.glite.jp/project/dependencies.properties
deleted file mode 100644
index ab3b83f..0000000
--- a/org.glite.jp/project/dependencies.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###################################################################
-# System dependencies
-###################################################################
-
-org.glite.version		= HEAD
-org.glite.jp.version		= HEAD
-
-# Component dependencies tag = do not remove this line =
-org.glite.jp.ws-interface.version	= HEAD
-org.glite.jp.common.version	= HEAD
-org.glite.jp.index.version	= HEAD
-org.glite.jp.primary.version	= HEAD
diff --git a/org.glite.jp/project/glite.jp.csf.xml b/org.glite.jp/project/glite.jp.csf.xml
deleted file mode 100644
index fd68f71..0000000
--- a/org.glite.jp/project/glite.jp.csf.xml
+++ /dev/null
@@ -1,271 +0,0 @@
-
-
-
-
-
-
-	
-
-	
-	
-		
-		
-			
-				
-					
-						 
-				 
-			 
-		 
-		
-		
-			
-				
-					 
-				
-					
-						 
-				 
-			 
-		 
-		
-		
-			
-				 
-		 
-		
-		
-			
-				
-					 
-				 
-		 
-
-		
-
-		
-			 
-
-		
-			 
-
-		
-			 
-
-		
-			 
-
-	 
-
-    	
-		 
-
-	
-
-	
- 	
-		 
-
-	
-		 
-
-	
- 	
-		The org.glite and org.glite.jp modules have been updated, please rerun the configuration file 
-	 
-
-	
-		The org.glite and org.glite.jp modules have been updated, please rerun the configuration file 
-	 
-
-	
-	
-	
-	
-	
- 	
-		 
-	
-		 
-
-	
-	
-		 
-	
-		 
-
-	
-	
-		 
-	
-		 
-	
-	
-	
-		 
-	
-		 
-
-	
- 	
- 		
- 			 
- 	 		
-
- 
diff --git a/org.glite.jp/project/properties.xml b/org.glite.jp/project/properties.xml
deleted file mode 100755
index 276cf76..0000000
--- a/org.glite.jp/project/properties.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-	
-	 
diff --git a/org.glite.jp/project/run-workspace b/org.glite.jp/project/run-workspace
deleted file mode 100644
index a5d1f54..0000000
--- a/org.glite.jp/project/run-workspace
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-cd ../..
-
-cvs co org.glite
-cvs co org.glite.jp
-                                                                                                                                                             
-cd org.glite.jp/project
-ant -f glite.jp.csf.xml
-
diff --git a/org.glite.jp/project/taskdefs.xml b/org.glite.jp/project/taskdefs.xml
deleted file mode 100755
index c4cc889..0000000
--- a/org.glite.jp/project/taskdefs.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-	
-	
-	
- 
\ No newline at end of file
diff --git a/org.glite.jp/project/version.properties b/org.glite.jp/project/version.properties
deleted file mode 100644
index cd1e9e7..0000000
--- a/org.glite.jp/project/version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-module.version=1.0.0
-module.age=1
diff --git a/org.glite.lb.client/project/version.properties b/org.glite.lb.client/project/version.properties
index 0ef0eb2..707ed52 100644
--- a/org.glite.lb.client/project/version.properties
+++ b/org.glite.lb.client/project/version.properties
@@ -1,3 +1,3 @@
 #Thu May 19 13:15:52 CEST 2005
-module.version=2.0.0
+module.version=2.0.1
 module.age=1
diff --git a/org.glite.lb.client/src/prod_proto.c b/org.glite.lb.client/src/prod_proto.c
index 7d24851..448aac0 100644
--- a/org.glite.lb.client/src/prod_proto.c
+++ b/org.glite.lb.client/src/prod_proto.c
@@ -66,18 +66,55 @@ int edg_wll_log_proto_handle_gss_failures(edg_wll_Context context, int code, edg
 }
 
 
-static edg_wll_Context tmp_context;
-static edg_wll_PlainConnection *tmp_conn;
+static int
+read_il_data_thr(char **buffer, 
+	     int (*reader)(char *, const int,edg_wll_Context,void *),edg_wll_Context ctx,void *conn)
+{
+  char buf[17];
+  int ret, len;
+
+  /* read 17 byte header */
+  len = (*reader)(buf, 17,ctx,conn);
+  if(len < 0) {
+    goto err;
+  }
+  buf[16] = 0;
+  if((len=atoi(buf)) <= 0) {
+    len = -1;
+    goto err;
+  }
+
+  /* allocate room for the body */
+  *buffer = malloc(len+1);
+  if(*buffer == NULL) {
+    len = -1;
+    goto err;
+  }
+
+  /* read body */
+  ret = (*reader)(*buffer, len,ctx,conn);
+  if(ret < 0) {
+    free(*buffer);
+    *buffer = NULL;
+    len = ret;
+    goto err;
+  }
+
+  (*buffer)[len] = 0;
+
+ err:
+  return(len);
+}
 
 static 
 int
-plain_reader(char *buffer, int max_len)
+plain_reader(char *buffer, int max_len,edg_wll_Context ctx,void *conn)
 {
 	int len;
 
-	len = edg_wll_plain_read_full(tmp_conn, buffer, max_len, &tmp_context->p_tmp_timeout);
+	len = edg_wll_plain_read_full(conn, buffer, max_len, &ctx->p_tmp_timeout);
 	if(len < 0) 
-		edg_wll_SetError(tmp_context, LB_PROTO, "get_reply_plain(): error reading message data");
+		edg_wll_SetError(ctx, LB_PROTO, "get_reply_plain(): error reading message data");
 
 	return(len);
 }
@@ -98,9 +135,7 @@ get_reply_plain(edg_wll_Context context, edg_wll_PlainConnection *conn, char **b
 	int len, code;
 
 	code = 0;
-	tmp_context = context;
-	tmp_conn = conn;
-	len = read_il_data(&msg, plain_reader);
+	len = read_il_data_thr(&msg, plain_reader,context,conn);
 	if(len < 0)
 		goto get_reply_plain_end;
 
@@ -116,20 +151,18 @@ get_reply_plain_end:
 }
 
 
-static edg_wll_GssConnection *tmp_gss_conn;
-
 static 
 int
-gss_reader(char *buffer, int max_len)
+gss_reader(char *buffer, int max_len,edg_wll_Context ctx,void *conn)
 {
 	int ret, len;
 	edg_wll_GssStatus gss_code;
 
-	ret = edg_wll_gss_read_full(tmp_gss_conn, buffer, max_len, &tmp_context->p_tmp_timeout,
+	ret = edg_wll_gss_read_full(conn, buffer, max_len, &ctx->p_tmp_timeout,
 				    &len, &gss_code);
 	if(ret < 0) {
-		edg_wll_log_proto_handle_gss_failures(tmp_context, ret, &gss_code, "edg_wll_gss_read_full");
-		edg_wll_UpdateError(tmp_context, LB_PROTO, "get_reply_gss(): error reading message");
+		edg_wll_log_proto_handle_gss_failures(ctx, ret, &gss_code, "edg_wll_gss_read_full");
+		edg_wll_UpdateError(ctx, LB_PROTO, "get_reply_gss(): error reading message");
 	}
 
 	return(ret);
@@ -143,9 +176,7 @@ get_reply_gss(edg_wll_Context context, edg_wll_GssConnection *conn, char **buf,
 	char *msg;
 	int code;
 
-	tmp_context = context;
-	tmp_gss_conn = conn;
-	code = read_il_data(&msg, gss_reader);
+	code = read_il_data_thr(&msg, gss_reader,context, conn);
 	if(code < 0)
 		goto get_reply_gss_end;
 
diff --git a/org.glite.lb.client/src/producer.c b/org.glite.lb.client/src/producer.c
index 27c71fd..bd6905c 100644
--- a/org.glite.lb.client/src/producer.c
+++ b/org.glite.lb.client/src/producer.c
@@ -127,7 +127,7 @@ static int edg_wll_DoLogEvent(
 	if ((answer = edg_wll_gss_connect(cred,
 			context->p_destination, context->p_dest_port, 
 			&context->p_tmp_timeout, &con, &gss_stat)) < 0) {
-		edg_wll_log_proto_handle_gss_failures(context,answer,&gss_stat,"edg_wll_gss_connect()");
+		answer = edg_wll_log_proto_handle_gss_failures(context,answer,&gss_stat,"edg_wll_gss_connect()");
 		goto edg_wll_DoLogEvent_end;
 	}
 
@@ -274,7 +274,7 @@ static int edg_wll_DoLogEventDirect(
 #endif
 	if ((answer = edg_wll_gss_connect(cred,host,port,
 			&context->p_tmp_timeout, &con, &gss_stat)) < 0) {
-		edg_wll_log_proto_handle_gss_failures(context,answer,&gss_stat,"edg_wll_gss_connect()");
+		answer = edg_wll_log_proto_handle_gss_failures(context,answer,&gss_stat,"edg_wll_gss_connect()");
 		goto edg_wll_DoLogEventDirect_end;
 	}
 
diff --git a/org.glite.lb.common/project/version.properties b/org.glite.lb.common/project/version.properties
index ad6ec55..c25d98c 100644
--- a/org.glite.lb.common/project/version.properties
+++ b/org.glite.lb.common/project/version.properties
@@ -1,3 +1,3 @@
 #Thu May 19 13:15:32 CEST 2005
-module.version=2.0.0
+module.version=2.0.1
 module.age=1
diff --git a/org.glite.lb.common/src/il_msg.c b/org.glite.lb.common/src/il_msg.c
index a9e3fff..8c6e973 100644
--- a/org.glite.lb.common/src/il_msg.c
+++ b/org.glite.lb.common/src/il_msg.c
@@ -7,15 +7,18 @@
 #include 
 #include 
 
+#define IL_PROTOCOL_MAGIC_WORD "michal"
+
 int 
 encode_il_msg(char **buffer, const char *event)
 {
   int len;
   char *p;
+  char *protocol_magic_word = IL_PROTOCOL_MAGIC_WORD;
 
 
   /* allocate enough room to hold the message */
-  len = 17 + len_string((char*)event);
+  len = 17 + len_string(protocol_magic_word) + len_string((char*)event);
   if((*buffer = malloc(len)) == NULL) {
     return(-1);
   }
@@ -27,6 +30,7 @@ encode_il_msg(char **buffer, const char *event)
   p += 17;
 
   /* write rest of the message */
+  p = put_string(p, protocol_magic_word);
   p = put_string(p, (char*)event);
 
   return(p - *buffer);
@@ -59,8 +63,21 @@ int
 decode_il_msg(char **event, const char *buf)
 {
   char *p;
+  char *protocol_magic_word=NULL;
+  int magic_word_check_failed = 0;
+
+  /* First check that the protocol 'magic' word is there */
+  p = get_string((char*)buf, &protocol_magic_word);
+  if (protocol_magic_word) {
+    if (strcmp (protocol_magic_word, IL_PROTOCOL_MAGIC_WORD) != 0) {
+      magic_word_check_failed = 1;
+    }
+    free(protocol_magic_word);
+  }
+
+  if (magic_word_check_failed != 0) return (-1);
 
-  p = get_string((char*)buf, event);
+  p = get_string(p, event);
   if(p == NULL) {
     if(*event) { free(*event); *event = NULL; };
     return(-1);
diff --git a/org.glite.lb.common/test/il_msg_test.cpp b/org.glite.lb.common/test/il_msg_test.cpp
index 6748bdb..230b6f1 100644
--- a/org.glite.lb.common/test/il_msg_test.cpp
+++ b/org.glite.lb.common/test/il_msg_test.cpp
@@ -28,7 +28,7 @@ public:
 	}
 
 	void testEncodeMsg() {
-		CPPUNIT_ASSERT_EQUAL(len_msg, 26);
+		CPPUNIT_ASSERT_EQUAL(len_msg, 35);
 		CPPUNIT_ASSERT(buffer_msg != NULL);
 		CPPUNIT_ASSERT(!strncmp(buffer_msg, msg, len_msg));
 	}
@@ -68,9 +68,9 @@ public:
 		char *s;
 
 		l = read_il_data(&s, test_reader);
-		CPPUNIT_ASSERT_EQUAL(l, 9);
+		CPPUNIT_ASSERT_EQUAL(l, 18);
 		CPPUNIT_ASSERT(s != NULL);
-		CPPUNIT_ASSERT(!strcmp(s, "6 zprava\n"));
+		CPPUNIT_ASSERT(!strcmp(s, "6 michal\n6 zprava\n"));
 		free(s);
 	}
 
@@ -87,7 +87,7 @@ private:
 	}
 };
 
-const char *IlMsgTest::msg = "               9\n6 zprava\n";
+const char *IlMsgTest::msg = "              18\n6 michal\n6 zprava\n";
 const char *IlMsgTest::rep = "              14\n10\n20\n5 chyba\n";
 int IlMsgTest::pos;
 
diff --git a/org.glite.lb.logger/project/version.properties b/org.glite.lb.logger/project/version.properties
index b993122..f2e2528 100644
--- a/org.glite.lb.logger/project/version.properties
+++ b/org.glite.lb.logger/project/version.properties
@@ -1,3 +1,3 @@
 #Thu May 19 13:16:38 CEST 2005
-module.version=1.1.1
+module.version=1.1.2
 module.age=1
diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile
index a1ce060..adbcd6b 100644
--- a/org.glite.lb.server/Makefile
+++ b/org.glite.lb.server/Makefile
@@ -36,7 +36,11 @@ GSOAP_FILES_PREFIX:= bk_ws_
 YACC=bison -y
 CC=gcc
 
-VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project
+ifeq ($(gsoap_version),2.7.0)
+	VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project:${gsoap_prefix}
+else
+	VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project
+endif
 AT3=perl -I${top_srcdir}/project ${top_srcdir}/project/at3
 
 TEST_LIBS:=-L${cppunit}/lib -lcppunit
@@ -56,7 +60,7 @@ CFLAGS:= \
 	-I${top_srcdir}/interface \
 	-I${expat_prefix}/include \
 	-I${ares_prefix}/include \
-	-I${gsoap_prefix}/include \
+	-I${gsoap_prefix}/include -I${gsoap_prefix}/ \
 	${COVERAGE_FLAGS} \
 	-I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \
 	-I${globus_prefix}/include/${nothrflavour} \
@@ -77,6 +81,12 @@ GLOBUS_LIBS:= -L${globus_prefix}/lib \
 	-lglobus_common_${nothrflavour} \
 	-lglobus_gssapi_gsi_${nothrflavour} \
 
+ifeq ($(shell ls ${gsoap_prefix}/bin/soapcpp2),${gsoap_prefix}/bin/soapcpp2)
+	gsoap_bin_prefix := ${gsoap_prefix}/bin
+else
+	gsoap_bin_prefix := ${gsoap_prefix}
+endif
+
 ifneq (${mysql_prefix},/usr)
 	ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
 		mysqlib := -L${mysql_prefix}/lib/mysql
@@ -115,20 +125,33 @@ BKSERVER_BASE_OBJS:= \
 	lb_xml_parse_V21.o \
 	lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \
 	stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \
-	notification.o il_notification.o notif_match.o stats.o
+	notification.o il_notification.o notif_match.o stats.o 
 
 ifeq ($(GLITE_LB_SERVER_WITH_WS),yes)
-	BKSERVER_OBJS:= \
-		${BKSERVER_BASE_OBJS} \
-		${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \
-		ws_query.o ws_fault.o ws_typeref.o 
-
-	BKSERVER_LIBS= \
-		${SRVBONES_LIB} \
-		-lglite_lb_common_${nothrflavour} \
-		-L${gsoap_prefix}/lib -lgsoap \
-		-lglite_security_gsoap_plugin_${nothrflavour} \
-		${EXT_LIBS}
+	ifeq ($(gsoap_version),2.7.0)
+		BKSERVER_OBJS:= \
+			${BKSERVER_BASE_OBJS} \
+			${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \
+			ws_query.o ws_fault.o ws_typeref.o stdsoap2.o
+
+		BKSERVER_LIBS= \
+			${SRVBONES_LIB} \
+			-lglite_lb_common_${nothrflavour} \
+			-lglite_security_gsoap_plugin_${nothrflavour} \
+			${EXT_LIBS}
+	else
+		BKSERVER_OBJS:= \
+			${BKSERVER_BASE_OBJS} \
+			${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \
+			ws_query.o ws_fault.o ws_typeref.o 
+
+		BKSERVER_LIBS= \
+			${SRVBONES_LIB} \
+			-lglite_lb_common_${nothrflavour} \
+			-L${gsoap_prefix}/lib -lgsoap \
+			-lglite_security_gsoap_plugin_${nothrflavour} \
+			${EXT_LIBS}
+	endif
 else
 	BKSERVER_OBJS:= ${BKSERVER_BASE_OBJS}
 		
@@ -191,7 +214,7 @@ lb_xml_parse.c: lb_xml_parse.c.T
 	chmod -w $@ >/dev/null
 
 ${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c ${GSOAP_FILES_PREFIX}Client.c ${GSOAP_FILES_PREFIX}ServerLib.c ${GSOAP_FILES_PREFIX}ClientLib.c LoggingAndBookkeeping.nsmap: LB.xh
-	${gsoap_prefix}/bin/soapcpp2 -w -c -p ${GSOAP_FILES_PREFIX} LB.xh
+	${gsoap_bin_prefix}/soapcpp2 -w -c -p ${GSOAP_FILES_PREFIX} LB.xh
 
 # try several times -- LB.wsdl downloads BaseFault.xsd from www.ibm.com which may be failing
 # not used right now but may be useful one day
@@ -203,7 +226,7 @@ ${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c
 
 LB.xh: ws_typemap.dat ${stagedir}/interface/LB.wsdl
 	cp ${stagedir}/interface/LBTypes.wsdl .
-	${gsoap_prefix}/bin/wsdl2h -c -t ${top_srcdir}/src/ws_typemap.dat -o $@ ${stagedir}/interface/LB.wsdl
+	${gsoap_bin_prefix}/wsdl2h -c -t ${top_srcdir}/src/ws_typemap.dat -o $@ ${stagedir}/interface/LB.wsdl
 	rm -f LBTypes.wsdl
 
 test.xml: test_xml
@@ -324,7 +347,7 @@ test_query_events.o: %.o: %.cpp
 	${COMPILE} -o $@ -c $<
 
 soap_version.h:
-	${gsoap_prefix}/bin/soapcpp2 /dev/null
+	${gsoap_bin_prefix}/soapcpp2 /dev/null
 	perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
 	-rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp
 
diff --git a/org.glite.lb.server/project/configure.properties.xml b/org.glite.lb.server/project/configure.properties.xml
index ffe0fff..5e1b1da 100644
--- a/org.glite.lb.server/project/configure.properties.xml
+++ b/org.glite.lb.server/project/configure.properties.xml
@@ -20,6 +20,9 @@
 
 	Revision history:
 	$Log$
+	Revision 1.7  2005/08/03 09:30:28  akrenek
+	Merged the release 1.0 branch
+	
 	Revision 1.6  2005/01/21 11:27:44  jpospi
 	completely remove gridsite.prefix and voms.prefix
 	
@@ -85,6 +88,7 @@ mysql_prefix=${with.mysql.prefix}
 mysql_version=${ext.mysql.version}
 cppunit=${with.cppunit.prefix}
 gsoap_prefix=${with.gsoap.prefix}
+gsoap_version=${ext.gsoap.version}
 			
 	    
 	
diff --git a/org.glite.lb.server/project/version.properties b/org.glite.lb.server/project/version.properties
index 21bc091..142f24a 100644
--- a/org.glite.lb.server/project/version.properties
+++ b/org.glite.lb.server/project/version.properties
@@ -1,3 +1,3 @@
 #Thu May 19 13:16:56 CEST 2005
-module.version=1.2.4
+module.version=1.2.5
 module.age=1
diff --git a/org.glite.lb/project/dependencies.properties b/org.glite.lb/project/dependencies.properties
index 6d9ae2f..50e2ffb 100644
--- a/org.glite.lb/project/dependencies.properties
+++ b/org.glite.lb/project/dependencies.properties
@@ -3,15 +3,25 @@
 # System dependencies
 ###################################################################
 
-org.glite.version 						= HEAD
-org.glite.lb.version 					= HEAD
+	
+
+	org.glite.version				= glite_R_1_0_5
+	org.glite.lb.version				= glite-lb_R_1_1_1
+		
+	org.glite.lb.client-interface.version				= glite-lb-client-interface_R_2_0_0
+				
+	org.glite.lb.ws-interface.version				= glite-lb-ws-interface_R_2_0_0
+				
+	org.glite.lb.common.version				= glite-lb-common_R_2_0_1
+				
+	org.glite.lb.client.version				= glite-lb-client_R_2_0_1
+				
+	org.glite.lb.server-bones.version				= glite-lb-server-bones_R_2_0_0
+				
+	org.glite.lb.logger.version				= glite-lb-logger_R_1_1_2
+				
+	org.glite.lb.server.version				= glite-lb-server_R_1_2_5
+				
+	org.glite.lb.proxy.version				= glite-lb-proxy_R_1_1_1
+				
 
-# Component dependencies tag = do not remove this line =
-org.glite.lb.client-interface.version 	= HEAD
-org.glite.lb.ws-interface.version 		= HEAD
-org.glite.lb.common.version 			= HEAD
-org.glite.lb.client.version 			= HEAD
-org.glite.lb.server.version 			= HEAD
-org.glite.lb.proxy.version 				= HEAD
-org.glite.lb.server-bones.version 		= HEAD
-org.glite.lb.logger.version 			= HEAD
diff --git a/org.glite.lb/project/version.properties b/org.glite.lb/project/version.properties
index 0f20f80..0670fcd 100644
--- a/org.glite.lb/project/version.properties
+++ b/org.glite.lb/project/version.properties
@@ -1,3 +1,3 @@
 #Thu May 19 13:17:34 CEST 2005
-module.version=1.1.0
+module.version=1.1.1
 module.age=1
diff --git a/org.glite.security.gsoap-plugin/Makefile b/org.glite.security.gsoap-plugin/Makefile
index 6fce5b1..4e33f8c 100644
--- a/org.glite.security.gsoap-plugin/Makefile
+++ b/org.glite.security.gsoap-plugin/Makefile
@@ -14,6 +14,7 @@ globus_prefix=/opt/globus
 nothrflavour=gcc32
 thrflavour=gcc32pthr
 gsoap_prefix=/opt/gsoap
+gsplugin_version_checking=yes
 
 CC=gcc
 
@@ -21,7 +22,6 @@ CC=gcc
 -include ../Makefile.inc
 
 GSPLUGIN_DEBUG?=no
-GSPLUGIN_VERSION_CHECKING?=yes
 
 version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :`
 
@@ -30,7 +30,7 @@ VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples
 TEST_LIBS:=-L${cppunit}/lib -lcppunit
 TEST_INC:=-I${cppunit}/include
 
-ifeq ($(GSPLUGIN_DEBUG),yes)
+ifeq ($(gsplugin_version_checking),yes)
 	DEBUG:=-g -O0 -Wall -DGSPLUGIN_DEBUG
 else
 	DEBUG:=-g -O0 -Wall
@@ -67,6 +67,8 @@ GSOAP_LIBS:= -L${gsoap_prefix}/lib -lgsoap
 
 EX_LIBS:= ${GLOBUS_LIBS} -L${ares_prefix}/lib -lares
 
+PATCHED_GSOAP_SRC:=stdsoap2_2.6.2.c
+
 HDRS:=glite_gss.h glite_gsplugin.h
 
 GSS_OBJS:=glite_gss.o
@@ -199,6 +201,7 @@ install:
 	cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${PREFIX}/include/glite/security/
 	if [ x${DOSTAGE} = xyes ]; then \
 		install -m 644 ${GSS_STATICLIB} ${GSS_THRSTATICLIB} ${STATICLIB} ${THRSTATICLIB} ${PREFIX}/lib; \
+		install -m 644 ${top_srcdir}/src/${PATCHED_GSOAP_SRC} ${PREFIX}/lib; \
 	fi
 
 clean:
diff --git a/org.glite.security.gsoap-plugin/build.xml b/org.glite.security.gsoap-plugin/build.xml
index b93e59c..1a2fc90 100755
--- a/org.glite.security.gsoap-plugin/build.xml
+++ b/org.glite.security.gsoap-plugin/build.xml
@@ -76,7 +76,7 @@
 		 Load version file 
 	     ========================================= -->
 	
-RedHat 9, Fedora, RHEL, Scientific Linix :
+RedHat 9 :
 This is the simpler case, since the standard release includes a suitable
 version of Apache 2.0: just install the gridsite-...-1.i386.rpm to get the
 various GridSite components. 
 
 
-Earlier, eg RedHat 7.3 :
+RedHat 7.3 :
 This is more complicated because you must also install a back-ported Apache
-2.0 RPM or build it from source. 
-
 
 
 GridSite also depends on shared libraries from libcurl and libxml2, and the
-RPMs distributed as part of the standard RedHat, from 7.3 onwards, are
+RPMs distributed as part of the standard RedHat 7.3 and 9 releases are
 sufficient. 
 
 
@@ -70,11 +65,8 @@ tools (htcp, urlencode.)
 
 All of the components use the GridSite library, and this in turn depends on
 libcurl and libxml2. You will need the development versions of these
-packages installed before you can proceed. 
-
 
 
Building GridSite with Make 
 
@@ -119,13 +111,11 @@ directory ../RPMTMP/RPMS/i386 relative to the working directory. An SRPM is
 put into ../RPMTMP/SRPMS
 This build assumes the Apache 2.0 includes are in /usr/include/httpd.
 
-
 
 
 For other configurations,
diff --git a/org.gridsite.core/doc/module.html b/org.gridsite.core/doc/module.html
index 9cc97d4..7f2096e 100644
--- a/org.gridsite.core/doc/module.html
+++ b/org.gridsite.core/doc/module.html
@@ -201,64 +201,6 @@ GridSite features in different ways.
     (Default: none)
 
 
-
GridSiteDowngrade on|off 
-Enable HTTPS Downgrade for this server, virtual server or directory:
-    HTTPS requests made with the header HTTP-Downgrade-Size: 
-    will be redirected to an HTTP version of the file, unless the file is
-    smaller than the given size.
-    
-
-
 GridSiteAuthCookiesDir path 
-Location of authentication cookies directory, relative to ServerRoot.
-    Used by HTTPS Downgrade to record the credentials obtained via HTTPS,
-    and available to the corresponding HTTP request.
-    
-
-
 GridSiteACLFormat GACL|XACML 
-Format to use when writing .gacl files. (Both formats are automatically
-    recognised when reading.)
-    
-
-
 GridSiteExecMethod nosetuid|suexec|X509DN|directory 
-Execution strategy for CGI scripts and executables. For options other
-    than nosetuid, suexec (or gsexec renamed suexec) must installed. For
-    X509DN and directory, gsexec must be installed, as suexec. 
-    
-
-
 GridSiteUserGroup user group 
-Unix user and group when using suexec (or gsexec as suexec.) This
-    is equivalent to the suexec SuexecUserGroup directive, but can be
-    specified on a per-directory basis.
-    
-
-
 GridSiteDiskMode GroupNone|GroupRead|GroupWrite WorldNone|WorldRead 
-The file creation permissions mode, taking two arguments to specify
-    the group and other permissions. The mode always includes read and write
-    permission for the CGI user itself.
-    
-
 
 
 
Environment variables 
@@ -324,27 +266,6 @@ in effect.
 If set, do not include credit links to GridSite in page footers.
 
 
-
  GRST_ACL_FORMAT 
-Format to use when writing .gacl files: either GACL or XACML.
-
-
-
 GRST_EXEC_METHOD 
-Specified by GridSiteExecMethod, either suexec, X509DN or directory.
-
-
-
 GRST_EXEC_DIRECTORY 
-The directory containing the CGI script or executable (used by gsexec
-    to determine which pool account to use in directory mapping mode.)
-
-
-
 GRST_DISK_MODE 
-The Apache  disk permission modes bit pattern, in hexadecimal,
-    starting with 0x. 
-    (Similar to the Unix bit pattern, except with hexadecimal rather than
-    octal values: eg 0x600 [Apache] vs 0600 [Unix] 
-    are both read/write for user only.)
-
-
 
 
 
                                                                                                                                                                                                                           
                 
%s 
diff --git a/org.gridsite.core/project/version.properties b/org.gridsite.core/project/version.properties
index 87511c8..45a3acb 100644
--- a/org.gridsite.core/project/version.properties
+++ b/org.gridsite.core/project/version.properties
@@ -1,2 +1,2 @@
-module.version=1.1.11
+module.version=1.1.10
 module.age=1
diff --git a/org.gridsite.core/src/Doxyfile b/org.gridsite.core/src/Doxyfile
index 14f88e0..e47d005 100644
--- a/org.gridsite.core/src/Doxyfile
+++ b/org.gridsite.core/src/Doxyfile
@@ -336,7 +336,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = . ../interface
+INPUT                  =
 
 # If the value of the INPUT tag contains directories, you can use the 
 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
diff --git a/org.gridsite.core/src/grst_admin_main.c b/org.gridsite.core/src/grst_admin_main.c
index a9e9f0e..22f0da5 100644
--- a/org.gridsite.core/src/grst_admin_main.c
+++ b/org.gridsite.core/src/grst_admin_main.c
@@ -87,7 +87,7 @@ void GRSThttpError(char *status)
   printf("Server-CGI: GridSite Admin %s\n", VERSION);
   printf("Content-Length: %d\n", 2 * strlen(status) + 58);
   puts("Content-Type: text/html\n");
-
+   
   printf("
\n", status);
    
@@ -108,7 +108,7 @@ void adminfooter(GRSThttpBody *bp, char *dn, char *help_uri, char *dir_uri,
                       dir_uri, admin_file);
   else GRSThttpPrintf(bp, ""
                       "Back to directory  .\n", dir_uri);
-
+  
   if (help_uri != NULL) 
     GRSThttpPrintf(bp, "Website Help  .\n", help_uri);
 
@@ -179,13 +179,13 @@ void justfooter(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
                 char *dir_uri, char *admin_file)
 {
   GRSThttpBody bp;
-
+ 
   puts("Status: 200 OK\nContent-Type: text/html");
    
   GRSThttpBodyInit(&bp);
  
   if (GRSTgaclPermHasList(perm) || GRSTgaclPermHasWrite(perm) 
-                                || GRSTgaclPermHasAdmin(perm))
+                                || GRSTgaclPermHasAdmin(perm)) 
                adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
 
   GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
@@ -195,10 +195,10 @@ void justfooter(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
 
 int main()
 {
-  int           i, gsiproxylimit_i = 1;
+  int           gsiproxylimit_i = 1;
   char         *cmd, *dir_uri, *file, *dir_path, *admin_file, *dn = NULL,
                *help_uri, *p, *content_type, *request_uri, *button, 
-               *grst_cred_0, *gsiproxylimit, *dn_lists, buf[12];
+               *grst_cred_0, *gsiproxylimit, *dn_lists;
   GRSTgaclCred *cred;
   GRSTgaclUser *user = NULL;
   GRSTgaclAcl  *acl;
@@ -233,24 +233,11 @@ int main()
           if ((p = index(grst_cred_0, ' ')) &&
               (p = index(++p, ' ')) &&
               (p = index(++p, ' ')) &&
-              (p = index(++p, ' '))) dn = &p[1];
-        }
-	      /* User has a cert so check for voms attributes */
-      for(i=1; ; i++)
-        {
-	   sprintf (buf, "GRST_CRED_%d", i);
-
-
-	   grst_cred_0 = getenv(buf);
-	   if (grst_cred_0==NULL) break;
-
-           if (cred=GRSTx509CompactToCred(grst_cred_0))
-                     GRSTgaclUserAddCred(user, cred);
-        }
-      /* no more voms attributes found found */
+              (p = index(++p, ' '))) dn = &p[1];          
+        }                                               
     }
   else if ((dn = getenv("SSL_CLIENT_S_DN")) != NULL)
-    {
+    {      
       cred = GRSTgaclCredNew("person");
       GRSTgaclCredAddValue(cred, "dn", dn);
       user = GRSTgaclUserNew(cred);
@@ -290,7 +277,7 @@ int main()
 
   if ((content_type != NULL) &&
       (GRSTstrCmpShort(content_type, "multipart/form-data; boundary=") == 0))
-    {
+    {    
       uploadfile(dn, perm, help_uri, dir_path, dir_uri, admin_file);
       return 0;
     }
diff --git a/org.gridsite.core/src/grst_gacl.c b/org.gridsite.core/src/grst_gacl.c
index 1df2f02..e5180de 100644
--- a/org.gridsite.core/src/grst_gacl.c
+++ b/org.gridsite.core/src/grst_gacl.c
@@ -837,7 +837,8 @@ int GRSTgaclUserHasCred(GRSTgaclUser *user, GRSTgaclCred *cred)
 {
   GRSTgaclCred      *crediter;
   GRSTgaclNamevalue *usernamevalue, *crednamevalue;
-
+  int i;
+  char buf[12];
 
   if (cred == NULL) return 0;
 
@@ -853,8 +854,33 @@ int GRSTgaclUserHasCred(GRSTgaclUser *user, GRSTgaclCred *cred)
       
       return GRSTgaclDNlistHasUser((cred->firstname)->value, user);
     }
+  /* Check for voms attributes*/
+  
+  if  (strcmp(cred->type, "voms")==0)
+    {
+      if ( (user->firstcred==NULL) ||
+           ((user->firstcred)->firstname == NULL) ||
+           (cred->firstname == NULL) ||
+           (strcmp((cred->firstname)->name, "fqan") != 0) ||
+           ((cred->firstname)->next != NULL)) return 0;
+          
+      /*assuimng only one name/value pair per cred*/
+      for(i=1; ; i++)
+      {
+	      sprintf (buf, "GRST_CRED_%d", i);
+	      if (getenv(buf)==NULL) break;
+
+	      if (strcmp ( 
+		           index(getenv(buf),'/'), 
+			   (cred->firstname)->value
+			 )  
+		   == 0) return 1;
+      }
+      /* no match found */
+      return 0;
+    }
 
-  if (strcmp(cred->type, "dns") == 0)
+  if (strcmp(cred->type, "dns") == 0) 
     {
       if ((user->firstcred == NULL) ||
           ((user->firstcred)->firstname == NULL) ||
diff --git a/org.gridsite.core/src/grst_x509.c b/org.gridsite.core/src/grst_x509.c
index ccf6100..942dd7e 100644
--- a/org.gridsite.core/src/grst_x509.c
+++ b/org.gridsite.core/src/grst_x509.c
@@ -647,7 +647,7 @@ GRSTgaclCred *GRSTx509CompactToCred(char *grst_cred)
 
    if (strncmp(grst_cred, "VOMS ", 5) == 0)
      {
-       if ((sscanf(grst_cred, "VOMS %lu %lu %d",
+       if ((sscanf(grst_cred, "VOMS %lu %lu", 
                               ¬before, ¬after, &delegation) == 3)
             && (now >= notbefore)
             && (now <= notafter)
@@ -658,11 +658,11 @@ GRSTgaclCred *GRSTx509CompactToCred(char *grst_cred)
          {
            /* include /VO/group/subgroup/Role=role/Capability=cap */
 
-           if (p[1] != '/') return NULL; /* must begin with / */
+           if (*p != '/') return NULL; /* must begin with / */
 
            cred = GRSTgaclCredNew("voms");
            GRSTgaclCredSetDelegation(cred, delegation);
-           GRSTgaclCredAddValue(cred, "fqan", &p[1]);
+           GRSTgaclCredAddValue(cred, "fqan", p);
          }
 
        return cred;