Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [EMF Store] update project programatically
|
Re: [EMF Store] update project programatically [message #1143981 is a reply to message #1143811] |
Fri, 18 October 2013 15:00 |
Edgar Mueller Messages: 89 Registered: March 2011 |
Member |
|
|
Hi Kristof,
did you login your ESUsersession correctly and used it to share your
project? Like this:
ESUsersession usersession = server.login("super", "super");
ESRemoteProject proj = remoProject.shareProject(usersession, new
ESSystemOutProgressMonitor());
The ESLocalProject#update method does not have an usersession parameter,
because a local project must have been shared and thus also must have a
valid userssesion.
Before calling ESLocalProject#update, what session instance does
ESLocalProject#getUserssesion() return? And what does the returned
instance return for isLoggedIn()?
Maybe you can post the relevant listing that is causing the exception.
Cheers,
Edgar
Am 18.10.2013 14:40, schrieb Zalecki, Kristof:
> Hi,
>
> I used the merging example from the git repo to build a simple client
> application to check out, create and update projects from my server, but
> when I'm trying to update my local project(s) I a always getting this error:
>
> !ENTRY org.eclipse.emf.emfstore.common.model 4 4 2013-10-18 14:16:22.347
> !MESSAGE Usersession not logged in. Login first.
> !STACK 0
> org.eclipse.emf.emfstore.server.exceptions.ESException: Usersession not
> logged in. Login first.
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.BasicSessionProvider.login(BasicSessionProvider.java:47)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:104)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:1)
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
> at
> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.loginUsersession(SessionManager.java:101)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:60)
> at
> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1263)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1241)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:445)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:1)
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
> at
> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
> at
> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
> at
> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
> at
> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.update(ESLocalProjectImpl.java:443)
> at
> org.eclipse.emf.emfstore.example.merging.Application.runClient(Application.java:133)
> at
> org.eclipse.emf.emfstore.example.merging.Application.start(Application.java:60)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
>
> It seems that the usersession is not set for my local project but the
> update() function does not have a parameter to set one like e.g. the
> checkout() or fetch() functions.
>
> I am getting the same error when running the original merging example btw.
>
> Regards,
> Kristof
>
--
Edgar Mueller
Get Professional Eclipse Support: http://eclipsesource.com/munich
|
|
|
Re: [EMF Store] update project programatically [message #1143993 is a reply to message #1143981] |
Fri, 18 October 2013 15:13 |
Maximilian Koegel Messages: 253 Registered: July 2009 |
Senior Member |
|
|
Hi Kristof,
thank you for reporting this issue in the newsgroup!
I hope Edgar can help you to get you up and running.
I just have one more pointer to documentation. The API tutorials also
contain installable (and runnable ;)) code examples for the EMFStore
API. Maybe they are helpful to you, too:
http://eclipsesource.com/blogs/tutorials/emfstore-api-basics/
Cheers,
Maximilian
Am 18.10.2013 17:00, schrieb Edgar Mueller:
> Hi Kristof,
>
> did you login your ESUsersession correctly and used it to share your
> project? Like this:
>
> ESUsersession usersession = server.login("super", "super");
> ESRemoteProject proj = remoProject.shareProject(usersession, new
> ESSystemOutProgressMonitor());
>
> The ESLocalProject#update method does not have an usersession parameter,
> because a local project must have been shared and thus also must have a
> valid userssesion.
>
> Before calling ESLocalProject#update, what session instance does
> ESLocalProject#getUserssesion() return? And what does the returned
> instance return for isLoggedIn()?
>
> Maybe you can post the relevant listing that is causing the exception.
>
> Cheers,
> Edgar
>
>
> Am 18.10.2013 14:40, schrieb Zalecki, Kristof:
>> Hi,
>>
>> I used the merging example from the git repo to build a simple client
>> application to check out, create and update projects from my server, but
>> when I'm trying to update my local project(s) I a always getting this
>> error:
>>
>> !ENTRY org.eclipse.emf.emfstore.common.model 4 4 2013-10-18 14:16:22.347
>> !MESSAGE Usersession not logged in. Login first.
>> !STACK 0
>> org.eclipse.emf.emfstore.server.exceptions.ESException: Usersession not
>> logged in. Login first.
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.BasicSessionProvider.login(BasicSessionProvider.java:47)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:104)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:1)
>>
>> at
>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>
>> at
>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>
>> at
>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.loginUsersession(SessionManager.java:101)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:60)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1263)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1241)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:445)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:1)
>>
>> at
>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>
>> at
>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>
>> at
>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.update(ESLocalProjectImpl.java:443)
>>
>> at
>> org.eclipse.emf.emfstore.example.merging.Application.runClient(Application.java:133)
>>
>> at
>> org.eclipse.emf.emfstore.example.merging.Application.start(Application.java:60)
>>
>> at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
>>
>> It seems that the usersession is not set for my local project but the
>> update() function does not have a parameter to set one like e.g. the
>> checkout() or fetch() functions.
>>
>> I am getting the same error when running the original merging example
>> btw.
>>
>> Regards,
>> Kristof
>>
>
>
--
Maximilian Kögel
Get Professional Eclipse Support: http://eclipsesource.com/munich
|
|
|
Re: [EMF Store] update project programatically [message #1149719 is a reply to message #1143993] |
Tue, 22 October 2013 08:56 |
Kristof Zalecki Messages: 23 Registered: October 2013 |
Junior Member |
|
|
Hi,
thanks for the quick reply! My client is creating a new local project if
the workspace is empty and no remote projects are present, which is done
like you described it. When I run my client a second time it checks the
workspace and tries to update the local project it finds. I basically
modified the merging example from your git repository.
ESLocalProject#getUserssesion() returns a usersession instance with the
correct username but null for the password.... isLoggedIn() returns
'true' though.
for (final ESLocalProject localProject : workspace.getLocalProjects()) {
if(localProject.isShared()) { log.info("usersession.isLoggedIn() =
"+usersession.isLoggedIn());
ESUsersession usrSession = localProject.getUsersession();
log.info(" ##### usrSession.getUsername() = "+usrSession.getUsername());
log.info(" ##### usrSession.getPassword() =
"+usrSession.getPassword()); localProject.update(null);
}
}
So I guess my problem is that I excpected the user session to be stored
in the local project and don't know how to do that correctly.
Regards,
Kristof
Am 18.10.2013 17:13, schrieb Maximilian Koegel:
> Hi Kristof,
>
> thank you for reporting this issue in the newsgroup!
> I hope Edgar can help you to get you up and running.
> I just have one more pointer to documentation. The API tutorials also
> contain installable (and runnable ;)) code examples for the EMFStore
> API. Maybe they are helpful to you, too:
> http://eclipsesource.com/blogs/tutorials/emfstore-api-basics/
>
> Cheers,
> Maximilian
>
>
> Am 18.10.2013 17:00, schrieb Edgar Mueller:
>> Hi Kristof,
>>
>> did you login your ESUsersession correctly and used it to share your
>> project? Like this:
>>
>> ESUsersession usersession = server.login("super", "super");
>> ESRemoteProject proj = remoProject.shareProject(usersession, new
>> ESSystemOutProgressMonitor());
>>
>> The ESLocalProject#update method does not have an usersession parameter,
>> because a local project must have been shared and thus also must have a
>> valid userssesion.
>>
>> Before calling ESLocalProject#update, what session instance does
>> ESLocalProject#getUserssesion() return? And what does the returned
>> instance return for isLoggedIn()?
>>
>> Maybe you can post the relevant listing that is causing the exception.
>>
>> Cheers,
>> Edgar
>>
>>
>> Am 18.10.2013 14:40, schrieb Zalecki, Kristof:
>>> Hi,
>>>
>>> I used the merging example from the git repo to build a simple client
>>> application to check out, create and update projects from my server, but
>>> when I'm trying to update my local project(s) I a always getting this
>>> error:
>>>
>>> !ENTRY org.eclipse.emf.emfstore.common.model 4 4 2013-10-18 14:16:22.347
>>> !MESSAGE Usersession not logged in. Login first.
>>> !STACK 0
>>> org.eclipse.emf.emfstore.server.exceptions.ESException: Usersession not
>>> logged in. Login first.
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.BasicSessionProvider.login(BasicSessionProvider.java:47)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:104)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:1)
>>>
>>> at
>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>>
>>> at
>>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>>
>>> at
>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.loginUsersession(SessionManager.java:101)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:60)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1263)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1241)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:445)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:1)
>>>
>>> at
>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>>
>>> at
>>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>>
>>> at
>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>>
>>> at
>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.update(ESLocalProjectImpl.java:443)
>>>
>>> at
>>> org.eclipse.emf.emfstore.example.merging.Application.runClient(Application.java:133)
>>>
>>> at
>>> org.eclipse.emf.emfstore.example.merging.Application.start(Application.java:60)
>>>
>>> at
>>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>> at java.lang.reflect.Method.invoke(Unknown Source)
>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
>>>
>>> It seems that the usersession is not set for my local project but the
>>> update() function does not have a parameter to set one like e.g. the
>>> checkout() or fetch() functions.
>>>
>>> I am getting the same error when running the original merging example
>>> btw.
>>>
>>> Regards,
>>> Kristof
>>>
>>
>>
>
>
|
|
|
Re: [EMF Store] update project programatically [message #1150419 is a reply to message #1149719] |
Tue, 22 October 2013 19:19 |
Maximilian Koegel Messages: 253 Registered: July 2009 |
Senior Member |
|
|
Hi Kristof,
the password is not stored permanently by default. Unfortunately there
is not yet API to store the password permanently or to set the password
again, I opened a bug to change this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=420110
As a workaround you can try the following using internal API:
After your first login of a usersession with ESServer.login() you
receive the usersession and cast it to ESUsersessionImpl. Calling
ESUsersessionImpl.toInternalAPI will provide you with a Usersession and
full access to all internals. By calling Usersession.setPassword() you
can set your password again. Now update should work without a problem.
To permanently store the password you need to do some extra steps. Call
Usersession.setSavePassword(true) to instruct the session to permanently
store the password and then save it with
ESWorkspaceImpl.toInternalAPI().save().
To avoid manual login you could additionally implement an
ESAbstractSessionProvider and register it at the
org.eclipse.emf.emfstore.client.usersessionProvider extension point. A
UsersessionProvider is called every time a usersession is required and
must be logged in. TestSessionProvider can serve as an example.
Hope this helps!
Cheers,
Maximilian
Am 22.10.2013 10:56, schrieb Zalecki, Kristof:
> Hi,
>
> thanks for the quick reply! My client is creating a new local project if
> the workspace is empty and no remote projects are present, which is done
> like you described it. When I run my client a second time it checks the
> workspace and tries to update the local project it finds. I basically
> modified the merging example from your git repository.
> ESLocalProject#getUserssesion() returns a usersession instance with the
> correct username but null for the password.... isLoggedIn() returns
> 'true' though.
>
> for (final ESLocalProject localProject : workspace.getLocalProjects()) {
> if(localProject.isShared()) { log.info("usersession.isLoggedIn() =
> "+usersession.isLoggedIn());
> ESUsersession usrSession = localProject.getUsersession();
> log.info(" ##### usrSession.getUsername() = "+usrSession.getUsername());
> log.info(" ##### usrSession.getPassword() =
> "+usrSession.getPassword()); localProject.update(null);
> }
> }
>
> So I guess my problem is that I excpected the user session to be stored
> in the local project and don't know how to do that correctly.
>
> Regards,
> Kristof
>
> Am 18.10.2013 17:13, schrieb Maximilian Koegel:
>> Hi Kristof,
>>
>> thank you for reporting this issue in the newsgroup!
>> I hope Edgar can help you to get you up and running.
>> I just have one more pointer to documentation. The API tutorials also
>> contain installable (and runnable ;)) code examples for the EMFStore
>> API. Maybe they are helpful to you, too:
>> http://eclipsesource.com/blogs/tutorials/emfstore-api-basics/
>>
>> Cheers,
>> Maximilian
>>
>>
>> Am 18.10.2013 17:00, schrieb Edgar Mueller:
>>> Hi Kristof,
>>>
>>> did you login your ESUsersession correctly and used it to share your
>>> project? Like this:
>>>
>>> ESUsersession usersession = server.login("super", "super");
>>> ESRemoteProject proj = remoProject.shareProject(usersession, new
>>> ESSystemOutProgressMonitor());
>>>
>>> The ESLocalProject#update method does not have an usersession parameter,
>>> because a local project must have been shared and thus also must have a
>>> valid userssesion.
>>>
>>> Before calling ESLocalProject#update, what session instance does
>>> ESLocalProject#getUserssesion() return? And what does the returned
>>> instance return for isLoggedIn()?
>>>
>>> Maybe you can post the relevant listing that is causing the exception.
>>>
>>> Cheers,
>>> Edgar
>>>
>>>
>>> Am 18.10.2013 14:40, schrieb Zalecki, Kristof:
>>>> Hi,
>>>>
>>>> I used the merging example from the git repo to build a simple client
>>>> application to check out, create and update projects from my server, but
>>>> when I'm trying to update my local project(s) I a always getting this
>>>> error:
>>>>
>>>> !ENTRY org.eclipse.emf.emfstore.common.model 4 4 2013-10-18 14:16:22.347
>>>> !MESSAGE Usersession not logged in. Login first.
>>>> !STACK 0
>>>> org.eclipse.emf.emfstore.server.exceptions.ESException: Usersession not
>>>> logged in. Login first.
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.BasicSessionProvider.login(BasicSessionProvider.java:47)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:104)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:1)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>>>
>>>> at
>>>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.loginUsersession(SessionManager.java:101)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:60)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1263)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1241)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:445)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:1)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>>>
>>>> at
>>>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.update(ESLocalProjectImpl.java:443)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.example.merging.Application.runClient(Application.java:133)
>>>>
>>>> at
>>>> org.eclipse.emf.emfstore.example.merging.Application.start(Application.java:60)
>>>>
>>>> at
>>>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
>>>>
>>>> at
>>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>> at java.lang.reflect.Method.invoke(Unknown Source)
>>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
>>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
>>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
>>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
>>>>
>>>> It seems that the usersession is not set for my local project but the
>>>> update() function does not have a parameter to set one like e.g. the
>>>> checkout() or fetch() functions.
>>>>
>>>> I am getting the same error when running the original merging example
>>>> btw.
>>>>
>>>> Regards,
>>>> Kristof
>>>>
>>>
>>>
>>
>>
>
--
Maximilian Kögel
Get Professional Eclipse Support: http://eclipsesource.com/munich
|
|
|
Re: [EMF Store] update project programatically [message #1153252 is a reply to message #1150419] |
Thu, 24 October 2013 13:30 |
Kristof Zalecki Messages: 23 Registered: October 2013 |
Junior Member |
|
|
Hi Maximilian,
thanks alot, your workaround works perfectly!
Regards,
Kristof
Am 22.10.2013 21:19, schrieb Maximilian Koegel:
> Hi Kristof,
>
> the password is not stored permanently by default. Unfortunately there
> is not yet API to store the password permanently or to set the password
> again, I opened a bug to change this:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=420110
>
> As a workaround you can try the following using internal API:
> After your first login of a usersession with ESServer.login() you
> receive the usersession and cast it to ESUsersessionImpl. Calling
> ESUsersessionImpl.toInternalAPI will provide you with a Usersession and
> full access to all internals. By calling Usersession.setPassword() you
> can set your password again. Now update should work without a problem.
> To permanently store the password you need to do some extra steps. Call
> Usersession.setSavePassword(true) to instruct the session to permanently
> store the password and then save it with
> ESWorkspaceImpl.toInternalAPI().save().
>
> To avoid manual login you could additionally implement an
> ESAbstractSessionProvider and register it at the
> org.eclipse.emf.emfstore.client.usersessionProvider extension point. A
> UsersessionProvider is called every time a usersession is required and
> must be logged in. TestSessionProvider can serve as an example.
>
> Hope this helps!
>
> Cheers,
> Maximilian
>
>
> Am 22.10.2013 10:56, schrieb Zalecki, Kristof:
>> Hi,
>>
>> thanks for the quick reply! My client is creating a new local project if
>> the workspace is empty and no remote projects are present, which is done
>> like you described it. When I run my client a second time it checks the
>> workspace and tries to update the local project it finds. I basically
>> modified the merging example from your git repository.
>> ESLocalProject#getUserssesion() returns a usersession instance with the
>> correct username but null for the password.... isLoggedIn() returns
>> 'true' though.
>>
>> for (final ESLocalProject localProject : workspace.getLocalProjects()) {
>> if(localProject.isShared()) { log.info("usersession.isLoggedIn() =
>> "+usersession.isLoggedIn());
>> ESUsersession usrSession = localProject.getUsersession();
>> log.info(" ##### usrSession.getUsername() = "+usrSession.getUsername());
>> log.info(" ##### usrSession.getPassword() =
>> "+usrSession.getPassword()); localProject.update(null);
>> }
>> }
>>
>> So I guess my problem is that I excpected the user session to be stored
>> in the local project and don't know how to do that correctly.
>>
>> Regards,
>> Kristof
>>
>> Am 18.10.2013 17:13, schrieb Maximilian Koegel:
>>> Hi Kristof,
>>>
>>> thank you for reporting this issue in the newsgroup!
>>> I hope Edgar can help you to get you up and running.
>>> I just have one more pointer to documentation. The API tutorials also
>>> contain installable (and runnable ;)) code examples for the EMFStore
>>> API. Maybe they are helpful to you, too:
>>> http://eclipsesource.com/blogs/tutorials/emfstore-api-basics/
>>>
>>> Cheers,
>>> Maximilian
>>>
>>>
>>> Am 18.10.2013 17:00, schrieb Edgar Mueller:
>>>> Hi Kristof,
>>>>
>>>> did you login your ESUsersession correctly and used it to share your
>>>> project? Like this:
>>>>
>>>> ESUsersession usersession = server.login("super", "super");
>>>> ESRemoteProject proj = remoProject.shareProject(usersession, new
>>>> ESSystemOutProgressMonitor());
>>>>
>>>> The ESLocalProject#update method does not have an usersession parameter,
>>>> because a local project must have been shared and thus also must have a
>>>> valid userssesion.
>>>>
>>>> Before calling ESLocalProject#update, what session instance does
>>>> ESLocalProject#getUserssesion() return? And what does the returned
>>>> instance return for isLoggedIn()?
>>>>
>>>> Maybe you can post the relevant listing that is causing the exception.
>>>>
>>>> Cheers,
>>>> Edgar
>>>>
>>>>
>>>> Am 18.10.2013 14:40, schrieb Zalecki, Kristof:
>>>>> Hi,
>>>>>
>>>>> I used the merging example from the git repo to build a simple client
>>>>> application to check out, create and update projects from my server, but
>>>>> when I'm trying to update my local project(s) I a always getting this
>>>>> error:
>>>>>
>>>>> !ENTRY org.eclipse.emf.emfstore.common.model 4 4 2013-10-18 14:16:22.347
>>>>> !MESSAGE Usersession not logged in. Login first.
>>>>> !STACK 0
>>>>> org.eclipse.emf.emfstore.server.exceptions.ESException: Usersession not
>>>>> logged in. Login first.
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.BasicSessionProvider.login(BasicSessionProvider.java:47)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:104)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager$2.call(SessionManager.java:1)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.loginUsersession(SessionManager.java:101)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.SessionManager.execute(SessionManager.java:60)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ServerCall.execute(ServerCall.java:269)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1263)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.impl.ProjectSpaceBase.update(ProjectSpaceBase.java:1241)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:445)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl$12.call(ESLocalProjectImpl.java:1)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException$1.doRun(RunESCommand.java:60)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.commandBody(EMFStoreCommandWithResult.java:31)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:64)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:70)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:108)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommandWithResult.run(EMFStoreCommandWithResult.java:59)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.client.util.RunESCommand$WithException.runWithResult(RunESCommand.java:77)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl.update(ESLocalProjectImpl.java:443)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.example.merging.Application.runClient(Application.java:133)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.emfstore.example.merging.Application.start(Application.java:60)
>>>>>
>>>>> at
>>>>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>>>>>
>>>>> at
>>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>>>>
>>>>> at
>>>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>>>>
>>>>> at
>>>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
>>>>>
>>>>> at
>>>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>>> at java.lang.reflect.Method.invoke(Unknown Source)
>>>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
>>>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
>>>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
>>>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
>>>>>
>>>>> It seems that the usersession is not set for my local project but the
>>>>> update() function does not have a parameter to set one like e.g. the
>>>>> checkout() or fetch() functions.
>>>>>
>>>>> I am getting the same error when running the original merging example
>>>>> btw.
>>>>>
>>>>> Regards,
>>>>> Kristof
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 19 20:49:48 GMT 2024
Powered by FUDForum. Page generated in 0.03550 seconds
|