Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFStore] Working with multiple usersessions
[EMFStore] Working with multiple usersessions [message #1440805] Wed, 08 October 2014 22:24 Go to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
I need to be able to switch between the current user and my hardcoded admin user in a procedure. I need to use my hardocded user to access that project and make commits .

My implementation psudocode is :

myUserSession = server.login("myuser", "mypass")

findProjectX(myusersession, server){
-check if project X is checked out in local and return it
-else check out the project X from server with myusersession
}

Add new fdata to project X

projectX.commit()



This works if every time I open the workspace I checkout the project. However, when I reopen the same workspace that has this project, on the commit XMLRPC gives this error:

Root exception:
org.eclipse.emf.emfstore.internal.server.exceptions.UnknownSessionException: Session unknown to Connection manager, log in first!
	at org.eclipse.emf.emfstore.internal.client.model.connectionmanager.AbstractConnectionManager.getConnectionProxy(AbstractConnectionManager.java:69)
	at org.eclipse.emf.emfstore.internal.client.model.connectionmanager.xmlrpc.XmlRpcConnectionManager.createVersion(XmlRpcConnectionManager.java:108)
	at org.eclipse.emf.emfstore.internal.client.model.controller.CommitController$2.run(CommitController.java:227)
	at org.eclipse.emf.emfstore.internal.client.model.controller.CommitController$2.run(CommitController.java:1)
	at org.eclipse.emf.emfstore.internal.client.common.UnknownEMFStoreWorkloadCommand$1.call(UnknownEMFStoreWorkloadCommand.java:73)


What do I need to do to avoid this problem?
Re: [EMFStore] Working with multiple usersessions [message #1442049 is a reply to message #1440805] Fri, 10 October 2014 14:44 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar MuellerFriend
Messages: 89
Registered: March 2011
Member
Hi Roza,

if the session already has been logged in once and setSavePassword has
been set previously to true, you only need to call refresh() on the user
session.

Cheers,
Edgar

--
Edgar Mueller

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] Working with multiple usersessions [message #1444322 is a reply to message #1442049] Tue, 14 October 2014 00:11 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
I tired this but it still gives me the same error. I checked the usersession, after I call the refresh() it actually assigned a sessionId which shows the log in is done. However, the ID is not added to the AbstractConnectionManager map, and as a result when I try to commit it throws the following exception.

org.eclipse.emf.emfstore.internal.server.exceptions.UnknownSessionException: Session unknown to Connection manager, log in first!
at org.eclipse.emf.emfstore.internal.client.model.connectionmanager.AbstractConnectionManager.getConnectionProxy(AbstractConnectionManager.java:69)
at org.eclipse.emf.emfstore.internal.client.model.connectionmanager.xmlrpc.XmlRpcConnectionManager.logout(XmlRpcConnectionManager.java:72)


[Updated on: Tue, 14 October 2014 00:21]

Report message to a moderator

Re: [EMFStore] Working with multiple usersessions [message #1445273 is a reply to message #1444322] Wed, 15 October 2014 08:03 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar MuellerFriend
Messages: 89
Registered: March 2011
Member
How did you try to refresh the session? Would you mind posting the
relevant code listing where you reopen an already checked-out project?
As already said, the usersession obtained from the checked-out project
must return true for isSavePassword, otherwise the server can not
determine a valid session.

> I tired this but it still gives me the same error
>
> org.eclipse.emf.emfstore.internal.server.exceptions.UnknownSessionException:
> Session unknown to Connection manager, log in first!
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.AbstractConnectionManager.getConnectionProxy(AbstractConnectionManager.java:69)
>
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.xmlrpc.XmlRpcConnectionManager.logout(XmlRpcConnectionManager.java:72)
>
>
>
>


--
Edgar Mueller

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] Working with multiple usersessions [message #1446430 is a reply to message #1445273] Thu, 16 October 2014 21:01 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
I just loop through local project


for (ESLocalProject locProject: esWs.getLocalProjects()){
			if (locProject.getProjectName().equals(TAG_PRJ_NAME)){
			
				locProject.getUsersession().refresh();

				if (locProject.hasUncommitedChanges())
					locProject.revert();
				locProject.update(subMontiro.newChild(1));
				return	locProject;
				
			}

		}


And later on in the code I make changes and call, locProject.commit and that's when I am getting the exception. Save password is set to true, and I see after refresh a sessionId is assigned, However, i still get the exception.

[Updated on: Thu, 16 October 2014 21:02]

Report message to a moderator

Re: [EMFStore] Working with multiple usersessions [message #1446804 is a reply to message #1446430] Fri, 17 October 2014 10:35 Go to previous message
Edgar Mueller is currently offline Edgar MuellerFriend
Messages: 89
Registered: March 2011
Member
Hi Roza,

can you please check two things:

1) Before doing locProject.getUsersession().refresh(), what is
isSavePassword() returning for that userssession? Also note down the
ESSessionId via getSessionId().

2) When doing the commit, are you absolutely that you are doing the
commit with the session you refreshed before (compare the ESSessionId of
the session you want to perform the commit with, with the ones you noted
down when you've refreshed the session)?

Is this problem probably related to the one you already mentioned
yesterday, i.e. the behaviour of EMFStoreClientUtil that currently
always creates new sessions instead of reusing the existing ones?

Cheers,
Edgar

> I just loop through local project
>
>
> for (ESLocalProject locProject: esWs.getLocalProjects()){
> if (locProject.getProjectName().equals(TAG_PRJ_NAME)){
>
> locProject.getUsersession().refresh();
>
> if (locProject.hasUncommitedChanges())
> locProject.revert();
> locProject.update(subMontiro.newChild(1));
> return locProject;
>
> }
>
> }
>
> And later on in the code I make changes and call, locProject.commit and
> that's when I am getting the exception.


--
Edgar Mueller

Get Professional Eclipse Support: http://eclipsesource.com/munich
Previous Topic:[EMFStore] disabling ceckout observer
Next Topic:using emfstore client in a standard java app (without eclipse)
Goto Forum:
  


Current Time: Mon Apr 06 22:29:44 GMT 2020

Powered by FUDForum. Page generated in 0.13955 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top