the overrided attach/detach methods of the extended class of the CDOResourceImpl class not be called [message #1446302] |
Thu, 16 October 2014 12:50  |
Eclipse User |
|
|
|
Hi everyone,
Firstly, i would like to explain my problem:
1. Problem: i created a plugin the permits to import papyrus models into the papyrus cdo model repository. For the purpose of overriding the attach/detach methods, i created a class that extends the CDOResourceImpl class. The problem is that, the attach/detach methods of my created class were not called when i add/delete elements of the models (because the created resources on the repository are instanceof the classic CDOReousrceImpl but not instancesof my created class).
2. What i did:
I created a PapyrusCDOResourceImpl class that extends the CDOResourceImpl class, and a resouce factory class :
class PapyrusCDOResourceFactoryImpl extends CDOResourceFactoryImpl
and then i tried to both register the resource factory class to the registry by using the ecore.protocole_parser extension point, and also register the registry programmatically like this:
Registry cdoReg = cdoTransaction_p.getResourceSet()
.getResourceFactoryRegistry();
Map<String, Object> protocolToFactoryMap = registry_p
.getProtocolToFactoryMap();
protocolToFactoryMap.remove(CDOProtocolConstants.PROTOCOL_NAME);
protocolToFactoryMap.put(CDOProtocolConstants.PROTOCOL_NAME,
new PapyrusCDOResourceFactoryImpl());
Thanks in advance for your help,
Kind Regards,
Hoa
|
|
|
Re: the overrided attach/detach methods of the extended class of the CDOResourceImpl class not be ca [message #1446355 is a reply to message #1446302] |
Thu, 16 October 2014 14:30   |
Eclipse User |
|
|
|
Hi, Hoa,
Have you had a look at what the org.eclipse.papyrus.cdo.core.importer
package offers for importing resources from the workspace into a CDO
repository? Why do you need to change the behaviour of the attached()
and detached() methods? What specific problem is that trying to solve?
Perhaps there is already a solution available, or a better path to a
solution.
Cheers,
Christian
On 2014-10-16 16:50:10 +0000, Nguyen Viet Hoa said:
> Hi everyone,
> Firstly, i would like to explain my problem:
>
> 1. Problem: i created a plugin the permits to import papyrus models
> into the papyrus cdo model repository. For the purpose of overriding
> the attach/detach methods, i created a class that extends the
> CDOResourceImpl class. The problem is that, the attach/detach methods
> of my created class were not called when i add/delete elements of the
> models (because the created resources on the repository are instanceof
> the classic CDOReousrceImpl but not instancesof my created class).
>
> 2. What i did:
>
> I created a PapyrusCDOResourceImpl class that extends the
> CDOResourceImpl class, and a resouce factory class :
> class PapyrusCDOResourceFactoryImpl extends CDOResourceFactoryImpl
>
> and then i tried to both register the resource factory class to the
> registry by using the ecore.protocole_parser extension point, and also
> register the registry programmatically like this:
> Registry cdoReg = cdoTransaction_p.getResourceSet()
> .getResourceFactoryRegistry();
> Map<String, Object> protocolToFactoryMap = registry_p
> .getProtocolToFactoryMap();
> protocolToFactoryMap.remove(CDOProtocolConstants.PROTOCOL_NAME);
> protocolToFactoryMap.put(CDOProtocolConstants.PROTOCOL_NAME,
> new PapyrusCDOResourceFactoryImpl());
>
> Thanks in advance for your help,
>
> Kind Regards,
>
> Hoa
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05750 seconds