dslforge icon indicating copy to clipboard operation
dslforge copied to clipboard

User home dir-based or programamble based org.dslforge.workspace.config.configuration

Open kgardas opened this issue 7 years ago • 6 comments

Hello, as mentioned in #45 it would be good either to have (a) programming way to specify workspace location or (b) support to use @user.home in specification of workspace location in extension point or (c) support to use workspace/derby purely in RAM of the current Java process.

The motivation behind this is that we would like to use dslforge-based editor in multi-user setup but strict rule needs to apply: NO data sharing between different application users. That means current dslforge does not obey this rule due to usage of shared workspace for Derby DB and we need to fix that in some possible way. Side-note: for different users of the application we are using different JDK processes and different home-dirs/workspaces to isolate users so far... Thanks! Karel

kgardas avatar Mar 27 '17 15:03 kgardas

Hi @kgardas , I don't recommend the programmable way to specify the workspace location, because the root path should be available early on startup for the database to start, and that path should not be modified afterwards. Are you considering to have one database/user ?

amlajmi avatar Mar 27 '17 19:03 amlajmi

Just to clarify, in (b) do you mean something like %user.home%/www/ in the extension point contribution? or a static method like @jabiercoding suggested in #45.

amlajmi avatar Mar 27 '17 19:03 amlajmi

Hi @amlajmi , in fact I also think that providing programable way would be the worst solution for this issue. Yes, I'd like to have one database per user to avoid any possible data-leaks between different users. And yes, in (b) I mean %user.home% (Windows?) or $HOME (Unix) or just @user.home (Eclipse launch supported way). The string would be substituted by actual user home directory name and what's over it would be added to it. E.g. in my case @user.home/myprojectworkspace/ would be substituted to /home/kgardas/myprojectworkspace -- and there you can append required .metadata (/home/kgardas/myprojectworkspace/.metadata) and then there you can create derby db as you like and this will surely not confuse our users. :-) -- so basically derby db will use the same workspace like our application is using. I hope this is not a showstopper for dslforge. If it is, no problem we can use different workspace but still this will be created in user home directory to prevent data leaks. Thanks! Karel

kgardas avatar Mar 28 '17 08:03 kgardas

Until now, the file system and the database go together, and I don't see any advantage of using the database if it's not for sharing information among users. Wouldn't it be better to disable it completely in your scenario ?

amlajmi avatar Mar 29 '17 08:03 amlajmi

@amlajmi There is a possibility to completely disable Derby? If so, I'm all for it in our particular case. Could you be so kind and point me to some information describing how to do it? Also if you do not think this issue is relevant after it just close it. Thanks! Karel

kgardas avatar Mar 29 '17 09:03 kgardas

This is feasible, the clean way to do it would be to add a boolean flag in the extension point definition, something like enableDatabase which is defaulted to true. Then, add a method in IWorkspaceContribution#isDatabaseEnabled(). In WorkspaceActivator#addingService() check the user contribution and based on that create the entity manager factory, see https://github.com/plugbee/dslforge/blob/2ea33c380248855806ed729e89b49ebdaba17d05/plugins/org.dslforge.workspace/src/org/dslforge/workspace/internal/WorkspaceActivator.java#L101

Normally, in the workspace manager, every operation on the file system is followed by the pattern:

		IPersistencyService dbservice = DefaultPersistencyService.getInstance();
		if (dbservice.isRunning()) {
			//do stuff on database
		}

So hopefully there is no additional work to do. If you're taking this path, please create a pull request, it would be nice to make this feature available for all of us, thanks.

amlajmi avatar Mar 29 '17 09:03 amlajmi