Subject Re: Design question for "attributed instances"
Author tdtappe
Yes - sure. I will try.
Probably I should have done this earlier. Sorry for that.

So what I finally like to have is some kind of RDBMS replacement for
hierarchcal data storage (like windows registry).
But also with some enhancements.
One main enhancement is the feature of letting some administrator
define the scope for the storage (per what I call "category").

So assume in my application I would like to load/store the
size/position of my windows. For this I would define a new category
"WIN_SIZEPOS".

For all categories there is a list of possible scope names (what I
called attributes in my last posts).
These scopes could be something like "COMPUTERNAME", "USERNAME",
"USERGROUP", "RDBMSLOGIN", "COMPANYNO", and so on.
The values for these scopes are usually set when the application
starts or after you logged in to some database or whenever.

For example if it was only the windows registry I wanted to be
replaced I would only need the scopes "COMPUTERNAME" and "USERNAME".
Because the windows registry is (more or less) locally stored for the
user. But I want more. And I want it to be changeable by an administrator.

Back to the WIN_SIZEPOS example. Maybe the administrator wants this
category to be handled in the scope of "COMPUTERNAME", "USERNAME" and
"COMPANYNO". "COMPANYNO" is just some number the user enters when he
starts the application. The database is devided into different
companies/departments.

Now all load/save actions for the category WIN_SIZEPOS are for
instance in the scope of COMPUTERNAME=PC01, USERNAME=ALI and
COMPANYNO=007

In my source code I would just have something like...

Sometime when the application starts:

setScopeValue("COMPUTERNAME", getComputerName());
setScopeValue("USERNAME", getUserName());
setScopeValue("COMPANYNO", "007");
...

When a windows saves its size/position:

Config cfg = new Config("WIN_SIZEPOS");
cfg.openKey("nameOfWindow");
cfg.writeString("size", <someRepresentationForSize>);
cfg.writeString("pos", <someRepresentationForPosition>);
cfg.closeKey();

The application looks for the scopes which have to be used for
WIN_SIZEPOS and then looks for an already existent instance with the
scope values provided at application start. If not it should create
one and then store the keys/values for this category instance.

Could I make myself clear enough?
Feel free to ask for a better explanation. I will do my very best ;-)

--Heiko

> Excuse me, i am still dont understand what do you trying to do..
> can you give your requirements with some data in listed.
> like this:
>
> CATAGORY
> --------
> USERS
> COMPUTERS
> PRINTERS
> BOOKS
> SINGERS
> HEROS
>
> ATTRIBUTES
> ----------
> MATRIX
> DEVELOPER
> DESIGNER
> DBA
> LASER
> AMD64
> ALICE IN WONDERLAND
> OPERATOR
> PINOKYO
> OFFICER
>
> VALUE
> -----
> HEIKO
> ALI
> ORSON WELLS
>
> now... what do you want to with HEIKO???