-----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.
[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...
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -
http://www.enigmail.net/
iQIcBAEBAgAGBQJSoDEGAAoJEL3BmMJQOtjBDssP/368rmo1gCeKScPtkyiEDrOF
pDGnWjdIprugXa6nTcUyKeJfQUZXDlJ+kLtGM14RGXNCFXdkhmMZLjpO2CjAxhAf
hB9rwqqyRPGlHtsa7qcPsgRPK6DVrI+qCoeLoyQHJqFokLE4AB04A0/2Ztb7B9BN
r/G1FNJmgcmfBbJ4saZ/+Lg/vMEeHa/Dx3z62jTAIMhADlaERQQt8ugTb3GZYKv2
m84uKE3G/BuiaY9I7t5vvPcM/wgw3UQZ+e4KuqloiAjPgDrwXyKrqAYLvXdzaYxO
HuU0BuEPy3MwNwP8+UTxcejeXjbNFeFa88Fk1PWy6U4KeqyI0uvMzzH1+QYCMm+e
PD6xZzWJ6GJB2JtYvuYgk8dUTzSEwlBd86FwQIAHZnpwiBOPVjyAQuBHmeOjPI+L
sU1fvv3k433W27lNhpYbkSk0N80vJH5mSC6drsBn9oJa8JImUVG5JP6Aa84U98DD
rsbiFhgpIrZeV4CE00HuHEN0gv8LCs7VgIgr7EUsQWDiuqdqjAgSxMAQkdxF3zwZ
cDaw6H3/FYqwt5qvp6jKksC4xODWfyYehV7sSU39JiplLr4q3FYpQkR0bBOovyN/
qge1CVTi6xaKoCuToB+UdPmpsM5scfoSXueguySSBrkpLr1Acl1AM/0V8j3/wN/J
zszyNPuVyENE0/USLokt
=0nwE
-----END PGP SIGNATURE-----