implementing my concrete create() methods for my EMF objects [message #644638] |
Mon, 13 December 2010 15:16 |
Tom H Messages: 139 Registered: July 2009 |
Senior Member |
|
|
I have my ecore objects persisted using a implementation of ResourceFactoryImpl() to my various backends.
However for certain types of objects say "SMSAccount" I need to go away and create assets for that user in other systems, so I need to
so I have something like this;
AccountingSwitch saveSwitch = new AccountingSwtich()
{
public Object caseAccount(Account object)
{
createSomestuff();
}
}
which I can put in my ResourceFactoryImpl() for save, but at the moment I can only see how to call save() on a resource, and not on individual EObjects.
Thanks,
T
[Updated on: Mon, 13 December 2010 16:52] Report message to a moderator
|
|
|
|
|
|
Re: implementing my concrete create() methods for my EMF objects [message #644728 is a reply to message #644724] |
Mon, 13 December 2010 23:50 |
Tom H Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Ed Merks wrote on Mon, 13 December 2010 17:48 | Tom,
Comments below.
Tom H wrote:
> well if for example one of my modelled objects was "User" I want to
> persist the user to XMI, but also I want to go and create a user in
> the OS or create a home directory as well in Java code.
You'd better only do that during save then...
What happens if the XMI file is just deleted?
>
> so basically I want to call UserManager.save(User) somewhere, and also
> UserManager.changePassword(User) whenever the password attribute is
> changed.
Again, only during save. After all, one might close the editor or undo
a change...
>
|
so when you say, only during save, do you mean that I should be over-riding the XMIResourceImpl and adding my functions to the save() call??
or some other way?
Thanks,
T
|
|
|
Re: implementing my concrete create() methods for my EMF objects [message #644731 is a reply to message #644728] |
Tue, 14 December 2010 00:10 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Tom,
Yes, I imagine you should be overriding some aspect of doSave. And
doDelete? I'm a little concerned about how what you're describing
really hangs together. Clearly XMI files can be deleted without any
opportunity for your special processing to kick in. Clearly it's also
possible for the things you create to be destroyed or modified in some
other way. I.e., what keeps these things consistent?
Tom H wrote:
> Ed Merks wrote on Mon, 13 December 2010 17:48
>> Tom,
>> Comments below.
>> Tom H wrote:
>> > well if for example one of my modelled objects was "User" I want to
>> > persist the user to XMI, but also I want to go and create a user in
>> > the OS or create a home directory as well in Java code.
>> You'd better only do that during save then...
>>
>> What happens if the XMI file is just deleted?
>> >
>> > so basically I want to call UserManager.save(User) somewhere, and
>> also > UserManager.changePassword(User) whenever the password
>> attribute is > changed.
>> Again, only during save. After all, one might close the editor or
>> undo a change...
>> >
>
>
> so when you say, only during save, do you mean that I should be
> over-riding the XMIResourceImpl and adding my functions to the save()
> call??
>
> or some other way?
>
> Thanks,
> T
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02976 seconds