Skip to main content



      Home
Home » Modeling » EMF » [CDO] Opening an EMF editor on a remote CDO repository([CDO] Opening an EMF editor on a remote CDO repository)
[CDO] Opening an EMF editor on a remote CDO repository [message #911751] Wed, 12 September 2012 04:54 Go to next message
Eclipse UserFriend
Hi,

I'm trying to open a generated EMF editor on a Resource located on a remote CDO repository (tcp://localhost:2036/REPO/resource.model).

I started by looking at the CDOViewProvider and the corresponding CDOViewProviderRegistry. To add an interactive prompt for credential (InteractiveCredentialsProvider).

-----------------------------------------------------------
public class MyViewProvider extends TCP {
/**
* Constructor.
*/
public MyViewProvider() {
super(DEFAULT_PRIORITY + 1);
}

@Override
protected CDONet4jSessionConfiguration getNet4jSessionConfiguration(IConnector connector,
String userName, String passWord, String repositoryName) {
final CDONet4jSessionConfiguration res = super.getNet4jSessionConfiguration(connector, userName,
passWord, repositoryName);

if (userName == null) {
res.getAuthenticator().setCredentialsProvider(new InteractiveCredentialsProvider());
}

return res;
}

}
-----------------------------------------------------------
In the activator of my plug-in

CDOViewProviderRegistry.INSTANCE.addViewProvider(new MyViewProvider());

-----------------------------------------------------------



Then I get an error about the tcp protocol that can't be handled by EMF so I added the followinf extension to my plug-in :

<extension
point="org.eclipse.emf.ecore.protocol_parser">
<parser
class="org.eclipse.emf.cdo.eresource.impl.CDOResourceFactoryImpl"
protocolName="tcp">
</parser>
</extension>

Now the editor open without error but I have a "CDOResource?" displayed in it an nothing more... I'm not prompted for any credencial either.

I open my editor like this :

URIEditorInput input = new URIEditorInput(URI.createURI("tcp://localhost:2036/REPO/resource.model"));
IEditorPart editor = IDE.openEditor(page, input, ID, true);

So my questions :

- Is it the good way of opening a CDO resource in a generated EMF Editor? Should I use an other kind of editor ?
- Any idea why I get this "CDOResource?" ?

regards,
Yvan.

[Updated on: Wed, 12 September 2012 04:55] by Moderator

Re: [CDO] Opening an EMF editor on a remote CDO repository [message #911781 is a reply to message #911751] Wed, 12 September 2012 05:57 Go to previous messageGo to next message
Eclipse UserFriend
Yvan,

I think the DAWN framework is the right thing for you.
It generates a CDO-capable editor for your model.
http://wiki.eclipse.org/Getting_Started_with_Dawn

Regards,
Tim
Re: [CDO] Opening an EMF editor on a remote CDO repository [message #911803 is a reply to message #911751] Wed, 12 September 2012 06:52 Go to previous messageGo to next message
Eclipse UserFriend
Am 12.09.2012 10:54, schrieb Yvan Lussaud:
> Hi,
>
> I'm trying to open a generated EMF editor on a Resource located on a remote CDO repository
> (tcp://localhost:2036/REPO/resource.model).
>
> I started by looking at the CDOViewProvider and the corresponding CDOViewProviderRegistry. To add an interactive
> prompt for credential (InteractiveCredentialsProvider).
I think all you need to do is to make sure that one of your plugins contributes a factory for this CredentialsProvider:

<extension
point="org.eclipse.net4j.util.factories">
<factory
class="org.eclipse.net4j.util.internal.ui.InteractiveCredentialsProviderFactory"
productGroup="org.eclipse.net4j.util.security.credentialsProviders"
type="interactive">
</factory>
</extension>

The org.eclipse.net4j.util.ui plugin already does that, but I guess you haven't deployed it.

> [...]
>
> I open my editor like this :
>
> URIEditorInput input = new URIEditorInput(URI.createURI("tcp://localhost:2036/REPO/resource.model"));
The URI should start with "cdo.net4j.tcp://" to make use of the ViewProviderRegistry and resolve "connection-aware"
URIs. Otherwise you'd have to specify a canonical URI and provide the needed view/transaction externally.

> IEditorPart editor = IDE.openEditor(page, input, ID, true);
>
> So my questions :
>
> - Is it the good way of opening a CDO resource in a generated EMF Editor?
If done right it should work ;-)

> Should I use an other kind of editor ?
That depends on your requirements. There's also the generic CDO editor which you could use via
CDOEditorUtil.openEditor(IWorkbenchPage, CDOView, String). Notice how you have to provide the view externally.

> - Any idea why I get this "CDOResource?" ?
This is an indication that the object (here a resource object) has been detached from the transaction. The question mark
indicates that the object has no permanent CDOID (anymore).

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Opening an EMF editor on a remote CDO repository [message #911817 is a reply to message #911751] Wed, 12 September 2012 07:31 Go to previous messageGo to next message
Eclipse UserFriend
It took me a while to find this EMF bugzilla I submitted recently: https://bugs.eclipse.org/bugs/show_bug.cgi?id=384036

It should make it easier to reuse a normal generated editor with non-standard storage providers such as CDO.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Opening an EMF editor on a remote CDO repository [message #911844 is a reply to message #911803] Wed, 12 September 2012 08:45 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your replies.

I changed the tcp to cdo.net4j.tcp and I get a SAX exception in the EMF generated editor... So I'll try the CDOEditor with a given transaction.

regards,
Yvan.
Re: [CDO] Opening an EMF editor on a remote CDO repository [message #911901 is a reply to message #911844] Wed, 12 September 2012 10:52 Go to previous message
Eclipse UserFriend
I had a configuration problem server side. That's why I had this Error. It work fine now thanks again for your help.
Previous Topic:convert or refactor classic-uml model?
Next Topic:Many Packages and ManyModelFiles -> No Refs Model load
Goto Forum:
  


Current Time: Fri Nov 07 23:33:04 EST 2025

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

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

Back to the top