| Summary: | Provide a URI format that contains connection information | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Lothar Werzinger <lothar> | ||||
| Component: | cdo.core | Assignee: | Eike Stepper <stepper> | ||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | alex.lagarde, erdal.karaca.de, martin.fluegge, stepper, vroldanbet | ||||
| Version: | 4.0 | Keywords: | noteworthy | ||||
| Target Milestone: | --- | ||||||
| Hardware: | Other | ||||||
| OS: | All | ||||||
| Whiteboard: | Appealing to a Broader Community | ||||||
| Attachments: |
|
||||||
|
Description
Lothar Werzinger
> Currently one can not access a CDO model with the generic EMF resource
> framework, as CDO does not (yet) have a URI schema that provides all the
> necessary information to connect to the CDO server to retrieve the resource.
While this bugzilla generally makes sense (i.e. add connection infos to the URI), I'd like to put this right: Of course one can access CDO resources with the generic EMF resource framework.
It just requires to register a CDOViewProvider with CDOViewProviderRegistry.INSTANCE, either programmatically or via the extension point org.eclipse.emf.cdo.viewProviders.
*** Bug 291574 has been marked as a duplicate of this bug. *** Adding password support: cdo.net4j.tcp://user:password@server:port/repository/MAIN/branch/@HEAD/folder/resource I'm a bit unsure about the time component, e.g. "@HEAD" in the path of the new URI format. Maybe it's better to make the view/tx target time a query parameter instead to prevent unfolding an indefinite layer in the resulting namespace (tree). opinions? (In reply to comment #3) > I'm a bit unsure about the time component, e.g. "@HEAD" in the path of the new > URI format. Maybe it's better to make the view/tx target time a query parameter > instead to prevent unfolding an indefinite layer in the resulting namespace > (tree). opinions? On the other hand we need a separator between the branchPath component and the resourcePath component. Currently that is a segment starting with "@", i.e. the timeStamp component I tend to make the branchPath component as well as the timeStamp component and possibly a readOnly component query parameters rather than part of the path... >I tend to make the branchPath component as well as the timeStamp component and
>possibly a readOnly component query parameters rather than part of the path...
I don't get the complete meaning of the sentence? Did you miss a word or am I simply to tired? ;)
What I understood is "query". And I think that sounds good. What about the following?
cdo.net4j.tcp://user:password@server:port/repository/folderpath/resource?branch=MAIN×tamp=HEAD
Eike, did you mean something like this?
The query part would allow us to insert additional and/or new parameters in the future and thus sounds like a flexible solution.
Or is there someting that speaks against using the query part?
(In reply to comment #6) > >I tend to make the branchPath component as well as the timeStamp component and > >possibly a readOnly component query parameters rather than part of the path... > > I don't get the complete meaning of the sentence? Did you miss a word or am I > simply to tired? ;) Too tried :P > What I understood is "query". And I think that sounds good. What about the > following? > > cdo.net4j.tcp://user:password@server:port/repository/folderpath/resource?branch=MAIN×tamp=HEAD That's exactly what I meant. Possibly and optionally plus "&readOnly=true" > Too tried :P O.k. Too tired :P >That's exactly what I meant. Possibly and optionally plus "&readOnly=true" Sounds good. :) Created attachment 180538 [details]
Patch v1 - for future reference
Committed to HEAD
The new (optional) connection-aware URI format is:
"cdo.net4j." connector-type "://" [user [":" password] "@"] connector-specific-authority "/" repository-name "/" resource-path ["?" param ("&" param)*]
With:
connector-type: tcp | jvm | http | ...
user/password: to be provided if the repository is configured with an IUserManager and, hence, triggers authentication on the client. NOTE: the password may be stored in resources in clear text!
connector-specific-authority:
host [":" port] if the connector-type is "tcp"
acceptor-name if the connector-type is "jvm"
repository-name: the name of the repository (not the UUID!)
resource-path: the full path of the resource within the repository, segments separated by slashes, no leading slash
param: one of
"branch=" branch-path, the full path of the branch in the branch tree, segments separated by slashes, no leading slash, defaults to "MAIN"
"time=" time-spec, the time at which the resource is supposed to be valid, parseable by SimpleDateFormat
"time=HEAD" indicates a floating view/transaction that always shows the latest state in the chosen branch, the default if no time parameter is specified
"transactional=true" forces a the resource to be opened in a transaction rather than in a read-only view, can not be combined with a time-spec other than "HEAD"
NOTE: With the current design and implementation of connection-aware URI (mainly CDONet4jViewProvider) it is still unclear when and how the allocated "resources" (aka IConnector, CDOSession, CDOView, etc) are supposed to be freed!
---
The canonical URI format is of course also available:
"cdo://" repository-uuid "/" resource-path
URIs in the canonical form to resolve properly require the resource set to be configured externally so that the connection to the correct repository can be established.
NOTE: CDOResources now preserve their original URI, that is not necessarily in canonical format!
I've fixed a bug in CDOURIData.toString() that produced the first (query-part-less) format. The credentials have been removed from serialized URIs. To load a CDOResource through a non-CDO resource if authentication is required an IPassordCredentialsProvider has to be registered in with IPluginContainer.INSTANCE, e.g.:
uri = URI.createURI("cdo.net4j.tcp://www.bar.com/repo1");
provider = new PasswordCredentialsProvider.Delegating(new InteractiveCredentialsProvider());
CDOUtil.setCredentialsProvider(uri, provider);
As established on EMF Community Forum (http://www.eclipse.org/forums/index.php?t=msg&goto=637142&S=d2575181f9e963b075ed35f97229f38a#msg_637142), it would be nice that users can activate such connection-aware URIs by default. For example, by using CDOURIUtil.setURIMode(URIMode.CONNECTION_AWARE) or session.options().setURIMode(), any CDO Object referenced in a local resource will be serialized using connection-aware URIs instead of standard CDO URIs. For example, if user didn't change the URIMode, a local resource referencing a CDOObject will be serialized as following : <referencedElement xmi:type="cars:Garage" href="cdo:/repo1/remoteSemanticResource.xmi#1"/> Therefore, if the connection to the CDO Repository is closed, there is no way to reconnect to this repository automatically. if the user has activated the CONNECTION_WARE mode for URIs : <referencedElement xmi:type="cars:Garage" href="cdo.net4j.tcp://localhost/repo1/remoteSemanticResource.xmi?transactional=true#1"/> Reconnection to Repositories will then be transparent to users. If possible, extension mechanisms should be provided to control how the reconnection is made by CDO (do the created session have to allow legacyMode, what is its PassiveUpdateMode...), so that this reconnection mechanism can be used in all useCases. Available in R20110608-1407 What do I have to do to make EcoreUti.getURI(eObject) return a connection aware URI? Is there an option or API to turn connection aware URI generation on/off as suggested by Alex in comment 13? |