@@ -121,12 +121,14 @@ class SzCfgShell(cmd.Cmd):
121121 self .engine_config = engine_config
122122 try :
123123 self .sz_factory = SzAbstractFactoryCore (MODULE_NAME , self .engine_config )
124+ self .sz_configmgr = self .sz_factory .create_configmanager ()
124125 except SzError as err :
125126 print (err )
126127 sys .exit (1 )
127128
128- self .sz_config = self .sz_factory .create_config ()
129- self .sz_configmgr = self .sz_factory .create_configmanager ()
129+ # TODO -
130+ # self.sz_config = self.sz_factory.create_config()
131+ # self.sz_configmgr = self.sz_factory.create_configmanager()
130132
131133 # Used to change the theme and for setting cmd prompt, use the default colors set by the terminal
132134 self .themes = Colors .AVAILABLE_THEMES
@@ -606,14 +608,22 @@ class SzCfgShell(cmd.Cmd):
606608
607609 # If a default config isn't found, create a new default configuration
608610 if not config_id :
609- config_handle = self .sz_config .create_config ()
610- default_config = self .sz_config .export_config (config_handle )
611-
611+ # TODO -
612+ # config_handle = self.sz_config.create_config()
613+ # default_config = self.sz_config.export_config(config_handle)
614+ sz_config = self .sz_configmgr .create_config_from_template ()
615+ default_config = sz_config .export ()
612616 # Persist new default config to Senzing Repository
613617 try :
614- config_id = self .sz_configmgr .add_config (
618+ # TODO -
619+ # config_id = self.sz_configmgr.add_config(
620+ # default_config,
621+ # f"New default configuration added by f{MODULE_NAME}.",
622+ # )
623+ # self.sz_configmgr.set_default_config_id(config_id)
624+ config_id = self .sz_configmgr .register_config (
615625 default_config ,
616- f"New default configuration added by f { MODULE_NAME } ." ,
626+ f"New default configuration added by { MODULE_NAME } ." ,
617627 )
618628 self .sz_configmgr .set_default_config_id (config_id )
619629 except SzError :
@@ -622,7 +632,10 @@ class SzCfgShell(cmd.Cmd):
622632 colorize_msg ("No configuration in the database, default config has been created" , "success" )
623633 self .sz_factory .reinitialize (config_id )
624634
625- current_config = self .sz_configmgr .get_config (config_id )
635+ # TODO -
636+ # current_config = self.sz_configmgr.get_config(config_id)
637+ sz_config = self .sz_configmgr .create_config_from_config_id (config_id )
638+ current_config = sz_config .export ()
626639 self .config_data = json .loads (current_config )
627640 self .config_updated = False
628641
@@ -725,7 +738,12 @@ class SzCfgShell(cmd.Cmd):
725738 return
726739
727740 try :
728- new_config_id = self .sz_configmgr .add_config (json .dumps (self .config_data ), f"Updated by { MODULE_NAME } " )
741+ # TODO -
742+ # new_config_id = self.sz_configmgr.add_config(json.dumps(self.config_data), f"Updated by {MODULE_NAME}")
743+ new_config_id = self .sz_configmgr .register_config (
744+ json .dumps (self .config_data ),
745+ f"Updated by { MODULE_NAME } " ,
746+ )
729747 self .sz_configmgr .set_default_config_id (new_config_id )
730748 self .sz_factory .reinitialize (new_config_id )
731749 self .config_updated = False
@@ -811,14 +829,15 @@ class SzCfgShell(cmd.Cmd):
811829 else :
812830 config_id = arg_list [1 ]
813831 try :
814- response = bytearray ()
815- self .sz_configmgr .getConfig (config_id , response )
816- json_data = json .loads (response .decode ())
832+ # TODO -
833+ # response = bytearray()
834+ response = self .sz_configmgr .create_config_from_config_id (config_id )
835+ json_data = json .loads (response )
817836 except SzError as err :
818837 colorize_msg (err , "error" )
819838 return
820839 try :
821- with open (fileName , "w" ) as fp :
840+ with open (fileName , "w" , encoding = "utf-8" ) as fp :
822841 json .dump (json_data , fp , indent = 4 , sort_keys = True )
823842 except OSError as err :
824843 colorize_msg (err , "error" )
0 commit comments