72 #include <wx/filename.h>
125 return "genbank_data_source";
131 return "GenBank Data Source";
149 if(items.size() != 1 || workbench ==
NULL) {
165 wxMenu* menu =
new wxMenu;
166 menu->Append(wxID_SEPARATOR,
wxT(
"Top Actions"));
169 contrib.first = menu;
202 "attempt to open already open data source");
216 registry.GetReadView(
"GBENCH.Services.ObjectManager");
221 int priority = view.
GetInt(
"Priority", 99);
226 if (
sizeof(
void*) == 8)
227 system_cache_path.append(
wxT(
"64"));
231 if ( !wxFileName::DirExists(system_cache_path) ) {
232 if ( !wxFileName::Mkdir(system_cache_path) ) {
234 << system_cache_path.ToUTF8() <<
"); caching will be disabled");
236 LOG_POST(
Info <<
"Created cache path: " << system_cache_path.ToUTF8());
240 const string ts_key =
"GBENCH.Application.LastRunBuildStamp";
241 const string st_build_date = __DATE__
"." __TIME__;
243 bool cache_reset = (last_run_build_date != st_build_date);
246 if (cache_reset ||
registry.
GetBool(
"GBENCH.Application.CrashDetected",
false)) {
247 ::wxRemoveFile(wxFileName(system_cache_path,
wxT(
"cache_ids.db")).GetFullPath());
248 ::wxRemoveFile(wxFileName(system_cache_path,
wxT(
"cache_blobs.db")).GetFullPath());
249 wxFileName vdb_cache_path =
wxFileName::DirName(system_cache_path + wxFileName::GetPathSeparator() +
"vdb");
250 vdb_cache_path.Rmdir(wxPATH_RMDIR_RECURSIVE);
251 vdb_cache_path.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
257 int cache_age = view.
GetInt(
"CacheAge", 5);
258 if (cache_age == 0) {
263 int id_resolution_time = view.
GetInt(
"IdResolutionTime", 24);
264 if (id_resolution_time > 24 * 3) {
265 id_resolution_time = 24 * 3;
268 wxString objmgr_config_path =
270 wxT(
"<std>/etc/gbench-objmgr.ini"));
272 if (objmgr_config_path.empty()) {
281 reg.
Set(
"genbank/cache/id_cache/sqlite3",
"database",
282 cache_path +
"/cache_ids.db");
283 reg.
Set(
"genbank/cache/id_cache/sqlite3",
"cache_age",
285 reg.
Set(
"genbank/cache/blob_cache/sqlite3",
"database",
286 cache_path +
"/cache_blobs.db");
287 reg.
Set(
"genbank/cache/blob_cache/sqlite3",
"cache_age",
301 msg =
"An error occurred while creating the GenBank connection\n(";
305 catch (std::exception& e) {
306 msg =
"An error occurred while creating the GenBank connection\n(";
311 if ( !msg.empty() ) {
319 LOG_POST(
Info <<
"Registered GenBank Data Source - " <<
t <<
" sec");
332 LOG_POST(
Info <<
"Registered VDBGraph, WGS and SNP data sources - " <<
t <<
" sec");
348 bool revoked =
m_ObjMgr->RevokeDataLoader(
"GBLOADER");
357 catch(std::exception&)
367 LOG_POST(
Error <<
"CGenBankUIDataSource::ShutDownService(): "
368 "object manager still referenced");
409 : m_Descr(
"GenBank Connection",
"")
413 wxT(
"gb_data_source.png"));
437 static string ext_id(
"genbank_data_source_type");
452 : m_SrvLocator(
NULL),
453 m_ParentWindow(
NULL),
457 m_ProjectSelPanel(
NULL)
524 return action ==
eNext;
557 if(action ==
eBack) {
560 }
else if(action ==
eNext) {
581 loader.
Reset( chain );
User-defined methods of the data storage class.
static void COpenDialog(IWorkbench *workbench, const string &loader_label=NcbiEmptyString, const vector< wxString > &filenames=vector< wxString >())
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, const SLoaderParams ¶ms, CObjectManager::EIsDefault is_default=CObjectManager::eNonDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
virtual void CloseCache(void)=0
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
CGenBankDSEvtHandler - wxEvtHandler-derived adapter for GenBank data source.
CGenBankDSEvtHandler(IWorkbench *workbench)
void OnLoadFromGenBank(wxCommandEvent &event)
CGenBankUIDataSourceType.
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
CProjectSelectorPanel - a panel that allows the user to specify how the project items created by a pl...
virtual bool TransferDataFromWindow()
void SetProjectService(CProjectService *service)
void GetParams(SProjectSelectorParams ¶ms) const
virtual bool TransferDataToWindow()
void SetParams(const SProjectSelectorParams ¶ms)
CProjectService - a service providing API for operations with Workspaces and Projects.
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
static wxString ResolvePathExisting(const wxString &path, const wxString &delim=wxT(","))
Utility function to hide the platform specifics of locating our standard directories.
CUICommandRegistry is a centralized registry where all application commands should be registered.
static CUICommandRegistry & GetInstance()
the main instance associated with the application
wxMenuItem * AppendMenuItem(wxMenu &menu, TCmdID cmd_id) const
pair< wxMenu *, wxEvtHandler * > TContribution
Contribution consists of a Menu object and event handler.
IServiceLocator - an abstract mechanism for locating services.
IUIDataSourceType - defines a type of a Data Source, can serve as a Data Source factory.
IUIDataSource - an interface representing a Data Source.
IUIObject - object that provides basic properties often required in a UI object.
IWorkbench is the central interface in the application framework.
virtual int GetType() const =0
const TData & GetData() const
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
string DirName(const string &path)
static const char * kProjectParamsTag
static const char * kGenBankLoadOption
static const char * kGB_DS_Icon
CGenBankUIDataSource.
static const char * kAppExpCmdExtPoint
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
void SaveMruAccessions(const string ®Path)
virtual void EditProperties()
void SaveSettings(const string ®Path)
CGenBankLoadOptionPanel * m_OptionPanel
SProjectSelectorParams m_ProjectParams
virtual const IUIObject & GetDescr()
returns UI description of the type (label, icon etc.)
virtual bool IsOpen()
a Data source needs to be open before use and closed after.
virtual void SetServiceLocator(IServiceLocator *locator)
virtual void CleanUI()
CleanUI() is called after the host finished using the manager.
virtual bool CanDo(EAction action)
Indicates whether given transition is possible in the current state.
IServiceLocator * m_SrvLocator
virtual void InitUI()
Initializes the Manager before using it in UI.
virtual IExplorerItemCmdContributor::TContribution GetMenu(wxTreeCtrl &treeCtrl, PT::TItems &items)
for the given set of items returns a contribution
CProjectSelectorPanel * m_ProjectSelPanel
virtual void SetRegistryPath(const string &path)
virtual wxEvtHandler * CreateEvtHandler()
const vector< string > & GetNAs() const
virtual bool DoTransition(EAction action)
Performs transition if possible and returns true, otherwise the function shall warn the user about th...
virtual const IUIObject & GetDescr()
returns UI description of the object (label, icon etc.)
virtual IUIToolManager * GetLoadManager()
virtual bool AutoCreateDefaultDataSource()
returns "true" if this type needs to create a default instance of the Data Source at start-up
virtual int GetDefaultCommand()
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CRef< objects::CObjectManager > m_ObjMgr
virtual void LoadSettings()
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
IServiceLocator * m_SrvLocator
virtual bool Open()
Prepares Data Source for use, any initialization that can be potentially time-consuming or may requir...
virtual void SaveSettings() const
virtual bool IsCompletedState()
Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred an...
virtual IUIDataSource * CreateDataSource()
factory method; create an Data Source instance
CGenBankUILoadManager()
CGenBankUILoadManager.
virtual bool IsFinalState()
True if Tool Manager has reached its final state, i.e.
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
wxWindow * m_ParentWindow
void Add(IObjectLoader *loader)
const vector< string > & GetGenomicAccessions() const
virtual IUIDataSourceType & GetType() const
virtual const IUIObject & GetDescriptor() const
Returns the object describing this tool (UI meta data).
virtual wxPanel * GetCurrentPanel()
Return the panel corresponding to the current state of Tool Manager.
CGenBankUIDataSourceType()
CGenBankUIDataSourceType.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual void SetServiceLocator(IServiceLocator *srv_locator)
Sets / unsets Service Locator.
virtual void SetParentWindow(wxWindow *parent)
CRef< CGenBankUIDataSourceType > m_Type
void LoadSettings(const string ®Path)
static CIRef< IExtensionRegistry > GetInstance()
provides access to the Singleton
virtual void SetLogEvent(const string &log_event)
virtual const string & GetLabel() const
const TParamTree * GetTree() const
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
string GetName(void) const
void SetLoaderOptions(const string &loader_name, EIsDefault is_default, TPriority priority=kPriority_Default)
Update loader's default-ness and priority.
CDataLoader * RegisterDataLoader(TPluginManagerParamTree *params=0, const string &driver_name=kEmptyStr)
Add data loader using plugin manager.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool ReferencedOnlyOnce(void) const THROWS_NONE
Check if object is referenced only once.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
virtual bool GetBool(const string §ion, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
IRWRegistry * Read(CNcbiIstream &is, TFlags flags=0, const string &path=kEmptyStr)
Read and parse the stream "is", and merge its content with current Registry entries.
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
bool Set(const string §ion, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
Set the configuration parameter value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
Defines process management classes.
Defines a portable execute class.
NetCache ICache client specs.
std::istream & in(std::istream &in_, double &x_)
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
void LoadSettings(CRegistryReadView &view, const string §ion)
bool m_CreateFolder
package in a single item
void ToLoadingOptions(CSelectProjectOptions &options)
void SaveSettings(CRegistryWriteView &view, const string §ion) const
wxFileArtProvider * GetDefaultFileArtProvider()
wxString ToWxString(const string &s)
wxString FnToWxString(const string &s)
string FnToStdString(const wxString &s)