2525import logging
2626import re
2727from wwpdb .utils .config .ConfigInfo import ConfigInfo
28+ from wwpdb .utils .config .ConfigInfoApp import ConfigInfoAppMessaging
2829# from mmcif_utils.persist.LockFile import LockFile
2930from wwpdb .apps .msgmodule .io .CompatIo import LockFile , PdbxMessageIo , getSiteId
3031# from wwpdb.io.locator.PathInfo import PathInfo
3132from wwpdb .apps .msgmodule .util .MessagingDataRouter import MessagingDataImport
3233# from mmcif_utils.message.PdbxMessageIo import PdbxMessageIo
3334# from wwpdb.apps.msgmodule.db.PdbxMessageIo import PdbxMessageIo
35+ from wwpdb .utils .session .WebRequest import InputRequest
3436
3537logger = logging .getLogger (__name__ )
3638
@@ -42,6 +44,8 @@ def __init__(self, siteId=None, verbose=False, log=sys.stderr):
4244 self .__siteId = siteId
4345 self .__verbose = verbose
4446 self .__log = log
47+ self .__legacycomm = not ConfigInfoAppMessaging (siteId ).get_msgdb_support ()
48+
4549 # self.__pI = PathInfo(siteId=self.__siteId, verbose=self.__verbose, log=self.__log)
4650 # Parameters to tune lock file management --
4751 self .__timeoutSeconds = 10
@@ -69,31 +73,23 @@ def __getMsgFilePath(self, depid, contentType, test_folder=None):
6973 else :
7074 logger .info ("look for message file for %s in the archive" , depid )
7175
72- # Create minimal request object for MessagingDataRouter
73- class SimpleReqObj :
74- def __init__ (self , site_id , identifier , instance = "P1" ):
75- self ._site_id = site_id
76- self ._identifier = identifier
77- self ._instance = instance
78-
79- def getValue (self , key ):
80- if key == "WWPDB_SITE_ID" :
81- return self ._site_id
82- elif key == "identifier" :
83- return self ._identifier
84- elif key == "instance" :
85- return self ._instance
86- return None
87-
88- def getSessionObj (self ):
89- return None
90-
9176 # Get actual site ID
92- actual_site_id = self .__siteId if self .__siteId is not None else getSiteId ()
77+ siteId = self .__siteId if self .__siteId is not None else getSiteId ()
9378
9479 # Create request object and use MessagingDataRouter
95- req_obj = SimpleReqObj (actual_site_id , depid )
96- msgDI = MessagingDataImport (req_obj , verbose = self .__verbose , log = self .__log )
80+ paramdict = {} # {"TopSessionPath": [self.__topSessionDir]}
81+ reqobj = InputRequest (paramdict , verbose = True )
82+ reqobj .setValue ("WWPDB_SITE_ID" , siteId )
83+ reqobj .setValue ("identifier" , depid )
84+ reqobj .setValue ("filesource" , "archive" )
85+ reqobj .setValue ("content_type" , "msgs" )
86+ # These might not be necessary
87+ if self .__legacycomm :
88+ reqobj .setValue ("instance" , "" )
89+ else :
90+ reqobj .setValue ("instance" , "P1" )
91+
92+ msgDI = MessagingDataImport (reqobj , verbose = self .__verbose , log = self .__log )
9793 filepath_msg = msgDI .getFilePath (contentType = contentType , format = "pdbx" )
9894
9995 # Don't check file existence - PdbxMessageIo handles database vs file mode automatically
0 commit comments