Hi, I have chosen an OpenLMI topic for my diploma thesis [1]. The goal of this thesis is to create an OpenLMI provider that would bring remote control over SSSD [2].
So far I have started by creating a simple provider, that provides one class called LMI_Test, with string field called Value. I'd like to provide getter and setter for Value, but I can't find a way how to change internal state of LMI_Test via a method call. Is it even possible/recommended? Or are methods supposed to manipulate with the object just in read-only manner? Can you give me some guidance please?
You can find the provider in my repository (branch wip): git://fedorapeople.org/home/fedora/pbrezina/public_git/openlmi_test.git
Thank you.
Regards, Pavel Březina.
[1] https://thesis-managementsystem.rhcloud.com/topic/show/10/create-openlmi-pro... [2] https://fedorahosted.org/sssd
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/03/2013 04:47 PM, Pavel Březina wrote:
Hi, I have chosen an OpenLMI topic for my diploma thesis [1]. The goal of this thesis is to create an OpenLMI provider that would bring remote control over SSSD [2].
So far I have started by creating a simple provider, that provides one class called LMI_Test, with string field called Value. I'd like to provide getter and setter for Value, but I can't find a way how to change internal state of LMI_Test via a method call. Is it even possible/recommended? Or are methods supposed to manipulate with the object just in read-only manner? Can you give me some guidance please?
You can find the provider in my repository (branch wip): git://fedorapeople.org/home/fedora/pbrezina/public_git/openlmi_test.git
Thank you.
Regards, Pavel Březina.
[1] https://thesis-managementsystem.rhcloud.com/topic/show/10/create-openlmi-pro...
Hi,
for every class, there already are "setters" and "getters" defined. They are called ModifyInstance() and GetInstance(). These are so called intrinsic methods, and all you have to do is implement them.
If you want to set Value from your method, you would first have to get an instance of LMI_Test (that is, call GetInstance()) in the method code, then modify Value and call ModifyInstance().
Some useful information:
http://www.openlmi.org/ -- project's main info site with all the docs
https://git.fedorahosted.org/cgit/openlmi-networking.git/ -- network providers
https://git.fedorahosted.org/cgit/openlmi-providers.git/ -- smaller providers
Note: From [1], if "Restarting SSSD" means restarting the sssd service via system means (e.g. systemctl on Fedora), that is probably already implemented in the Service provider (see openlmi-providers).
Also, I cloned your repository, but I can't see any branches but master.
I hope I could help,
- -- Jan Synacek Software Engineer, Red Hat
On 12/04/2013 08:29 AM, Jan Synacek wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/03/2013 04:47 PM, Pavel Březina wrote:
Hi, I have chosen an OpenLMI topic for my diploma thesis [1]. The goal of this thesis is to create an OpenLMI provider that would bring remote control over SSSD [2].
So far I have started by creating a simple provider, that provides one class called LMI_Test, with string field called Value. I'd like to provide getter and setter for Value, but I can't find a way how to change internal state of LMI_Test via a method call. Is it even possible/recommended? Or are methods supposed to manipulate with the object just in read-only manner? Can you give me some guidance please?
You can find the provider in my repository (branch wip): git://fedorapeople.org/home/fedora/pbrezina/public_git/openlmi_test.git
Thank you.
Regards, Pavel Březina.
[1] https://thesis-managementsystem.rhcloud.com/topic/show/10/create-openlmi-pro...
Hi,
for every class, there already are "setters" and "getters" defined. They are called ModifyInstance() and GetInstance(). These are so called intrinsic methods, and all you have to do is implement them.
If you want to set Value from your method, you would first have to get an instance of LMI_Test (that is, call GetInstance()) in the method code, then modify Value and call ModifyInstance().
I'm starting to think that I misinterpreted what the instance is in the context of cmpi. I probably tried to work with it too much as in OOP.
GetInstance() should return new instance according to object path and recreate all non-key properties?
And ModifyInstance() should modify the instance so that it can be recreated by GetInstance()?
So if the instance is not stored in some sort of memory and is currently hardcoded into a provider, I have no tools to modify the instance?
Some useful information:
http://www.openlmi.org/ -- project's main info site with all the docs
https://git.fedorahosted.org/cgit/openlmi-networking.git/ -- network providers
https://git.fedorahosted.org/cgit/openlmi-providers.git/ -- smaller providers
Note: From [1], if "Restarting SSSD" means restarting the sssd service via system means (e.g. systemctl on Fedora), that is probably already implemented in the Service provider (see openlmi-providers).
Also, I cloned your repository, but I can't see any branches but master.
Strange, there should be also a branch called "wip" that contains current code. Here's link to cgit: http://fedorapeople.org/cgit/pbrezina/public_git/openlmi_test.git/tree/?h=wi...
I hope I could help,
Jan Synacek Software Engineer, Red Hat -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJSntm5AAoJEL3BmMJQOtjBLdEP/1H3stQRN0agcyXccmKoWB3w NFhvYJEjW2JDXvSShcyYa/0QdkGzmFNA80Uqp9574k6uxLEX+2YnBbNQciRRJbU9 Dl4o/vHbnum6H/c3iPKS0q1OrGDg/WulrzTZE+Hr1vjaf6pp9qOGujHc25kGKxyN 3zN97uOcZ8QKPcHoYZsa4TI3eHCwVZxpAdEx4iKA19E59T4t0QoTVgS60Hb7xRk6 jMY4obewKZsnMSlSX+2d/aM/Sj7N9xeu2vCA9IU49IEJF9N6lwj7Omfjjo+UPZvR FYF7HmybKULQ+5W0eMF0Z6kNCbBrIqxHNI6mHGiScO/Lfs9SsWkuKaw47/sWSR0f 2KtAkrlOImhys7owXz/kXanGSb4/FLwpPi22EIKpAWZoTztbYu4fWE+oVTmzW5QR npWAzIJUz6D20UGhyFaM8gtT4XEXdho8OWB5uLwTndI0q++7FT1F8aonW0o9MLbI TeF92BvrTlkwc8Z3UmwjArTnhnEOj/v7sOG/Eq0RPsZtuXfZPIoKvyUP4tbEJwwA 4Wne3AguWZt/nfYll2hM4hFjWVif2qZ3Xe02YbvipFhiB05zG0ub+vphvxzX1tzn E7K+dw/u9PRxXwqCLXDdjgcrNoiXUh12QECp71rXnAASOQXQf/v7L/tntxbtK2Ap 8a7vXtS1swPQTtrA3VC0 =lqXy -----END PGP SIGNATURE-----
* Pavel Březina pbrezina@redhat.com [Dec 04. 2013 15:17]:
I'm starting to think that I misinterpreted what the instance is in the context of cmpi. I probably tried to work with it too much as in OOP.
GetInstance() should return new instance according to object path and recreate all non-key properties?
Pavel,
cmpi providers are used to model the 'real world' into the CIM information model. Instances in CIM are instantiated classes, representing an underlying 'thing' (network interface, running process, installed package, hardware item, ...). The common name is 'configuration item' or 'CI' - something contributing to the overall service configuration.
GetInstance() returns a current view of the configuration item according to the respective CIM class. In the CIM information model, this is a list of typed properties with values. The key properties are a set of instance properties uniquely identifing this instance.
And ModifyInstance() should modify the instance so that it can be recreated by GetInstance()?
ModifyInstance() should modify the underlying configuration item according to the changed properties passed in the ModifyInstance() call. This is somewhat delicate and used very seldomly. The usual means of actually changing configuration items is via instance methods or ElementSettingData. See the service profiles (http://www.dmtf.org/standards/profiles)
So if the instance is not stored in some sort of memory and is currently hardcoded into a provider, I have no tools to modify the instance?
Yes. Esp. since providers are dynamic and can be unloaded by the CIMOM at any time. However, for CIM instances not representing a configuration item, the CIMOM provides the ability to store instances in the CIMOM database.
For testing purposes, you can make your provider 'sticky' by returning a 'do not unload' response to a cleanup request. But this is actually considered bad practice.
Hth, Klaus
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/04/2013 03:17 PM, Pavel Březina wrote:
On 12/04/2013 08:29 AM, Jan Synacek wrote: On 12/03/2013 04:47 PM, Pavel Březina wrote:
Hi, I have chosen an OpenLMI topic for my diploma thesis [1]. The goal of this thesis is to create an OpenLMI provider that would bring remote control over SSSD [2].
So far I have started by creating a simple provider, that provides one class called LMI_Test, with string field called Value. I'd like to provide getter and setter for Value, but I can't find a way how to change internal state of LMI_Test via a method call. Is it even possible/recommended? Or are methods supposed to manipulate with the object just in read-only manner? Can you give me some guidance please?
You can find the provider in my repository (branch wip): git://fedorapeople.org/home/fedora/pbrezina/public_git/openlmi_test.git
Thank you.
Regards, Pavel Březina.
[1] https://thesis-managementsystem.rhcloud.com/topic/show/10/create-openlmi-pro...
[2] https://fedorahosted.org/sssd
Hi,
for every class, there already are "setters" and "getters" defined. They are called ModifyInstance() and GetInstance(). These are so called intrinsic methods, and all you have to do is implement them.
If you want to set Value from your method, you would first have to get an instance of LMI_Test (that is, call GetInstance()) in the method code, then modify Value and call ModifyInstance().
I'm starting to think that I misinterpreted what the instance is in the context of cmpi. I probably tried to work with it too much as in OOP.
Well, CIM object model is OO, some stuff is just called differently, but class/instance should be the same.
GetInstance() should return new instance according to object path and recreate all non-key properties?
It returns an existing instance, not new one in the sense of the "new" operator in C++, for example. And you specify that instance by its "primary key", that is, the object path. You can then fill the non-key properties, you can even change the key properties.
And ModifyInstance() should modify the instance so that it can be recreated by GetInstance()?
Sort of. After ModifyInstance(), the modified instance is "stored" on the server and you can get it later by GetInstance(), if that's what you meant by "recreate". But there are better ways to change stuff, as Klaus already pointed out.
So if the instance is not stored in some sort of memory and is currently hardcoded into a provider, I have no tools to modify the instance?
That's right. There's no way (that I know of) how to modify an instance directly on the server.
Strange, there should be also a branch called "wip" that contains current code. Here's link to cgit: http://fedorapeople.org/cgit/pbrezina/public_git/openlmi_test.git/tree/?h=wi...
Aha,
the link you provided and the one I used is for read/write access and didn't clone properly. I used another one and it works now.
- -- Jan Synacek Software Engineer, Red Hat
On 12/03/2013 04:47 PM, Pavel Březina wrote:
Hi, I have chosen an OpenLMI topic for my diploma thesis [1]. The goal of this thesis is to create an OpenLMI provider that would bring remote control over SSSD [2].
So far I have started by creating a simple provider, that provides one class called LMI_Test, with string field called Value. I'd like to provide getter and setter for Value, but I can't find a way how to change internal state of LMI_Test via a method call. Is it even possible/recommended? Or are methods supposed to manipulate with the object just in read-only manner? Can you give me some guidance please?
You can find the provider in my repository (branch wip): git://fedorapeople.org/home/fedora/pbrezina/public_git/openlmi_test.git
Thank you.
Regards, Pavel Březina.
[1] https://thesis-managementsystem.rhcloud.com/topic/show/10/create-openlmi-pro...
Hi, I created a new test provider based on your answers. It reads /tmp/lmitest file as id:value database. Could you please review it?
I have few follow up questions.
1. Is there a more straightforward way to convert LMI_TestRef to LMI_Test in konkret than this:
CMPIInstance *ci = NULL; CMPIObjectPath *cop = NULL; LMI_Test lmi_test;
cop = LMI_TestRef_ToObjectPath(self, status); if (!KOkay(*status)) { return (KString)KSTRING_INIT; }
ci = CBGetInstance(cb, context, cop, NULL, status); if (!KOkay(*status)) { return (KString)KSTRING_INIT; }
LMI_Test_InitFromInstance(&lmi_test, cb, ci);
2. What are the use cases of LMI_TestExecQuery?
Thanks, Pavel.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/19/2013 12:26 PM, Pavel Březina wrote:
I have few follow up questions.
- Is there a more straightforward way to convert LMI_TestRef to LMI_Test in konkret than this:
There should be a LMI_TestRef_ToInstance() function in your header file.
- -- Jan Synacek Software Engineer, Red Hat
openlmi-devel@lists.stg.fedorahosted.org