Index: openacs-4/packages/acs-core-docs/www/object-system-design.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/object-system-design.html,v diff -u -r1.34.2.1 -r1.34.2.2 --- openacs-4/packages/acs-core-docs/www/object-system-design.html 9 Jun 2016 08:44:50 -0000 1.34.2.1 +++ openacs-4/packages/acs-core-docs/www/object-system-design.html 23 Jun 2016 08:32:45 -0000 1.34.2.2 @@ -20,7 +20,7 @@ data model that keeps track of the application objects that we wish to manage, and serves as a primary store of metadata. By metadata, we mean data stored on behalf of an application -outside of the application's data model in order to enable +outside of the application's data model in order to enable certain central services. The OpenACS 4 Object Model (or object system) manages several different kinds of data and metadata to allow us to provide general services to applications:
Every application object is given a unique identifier in the system. This @@ -82,7 +82,7 @@ notion of "scoping" was introduced into the core data model.
"Scope" is a term best explained by example. Consider some
hypothetical rows in the address_book
table:
... | scope | user_id | group_id | ... |
... | user | 123 | ... | |
... | group | 456 | ... | |
... | public | ... |
The first row represents an entry in User 123's personal address book, the second row represents an entry in User Group 456's shared address -book, and the third row represents an entry in the site's public address +book, and the third row represents an entry in the site's public address book.
In this way, the scoping columns identify the security context in which a
given object belongs, where each context is either a person
or a group of people or the general public (itself a group
@@ -94,11 +94,11 @@
forum message would probably list a forum topic as its context, and a
forum topic might list a subsite as its context. Thus, contexts make it
easier to break the site up into security domains according to its natural
-structure. An object's context is stored in the context_id
-column of the acs_objects
table.
We use an object's context to provide a default answer to questions
+structure. An object's context is stored in the context_id
+column of the acs_objects
table.
We use an object's context to provide a default answer to questions regarding access control. Whenever we ask a question of the form "can user X perform action Y on object Z", the OpenACS security model will defer -to an object's context if there is no information about user X's +to an object's context if there is no information about user X's permission to perform action Y on object Z.
The context system forms the basis for the rest of the OpenACS access control system, which is described in in two separate documents: one for the permissions system and another for the party groups system. The context system @@ -138,7 +138,7 @@ these fat tables have a couple of other problems:
They degrade performance.
Denormalization can make it hard to maintain consistency constraints on the data.
Object subtypes provide a way to factor the data model while still keeping track of the fact that each member of a subtype (i.e. for each row in the -subtype's table), is also a member of the parent type (i.e. there is a +subtype's table), is also a member of the parent type (i.e. there is a corresponding row in the parent type table). Therefore, applications an use this mechanism without worrying about this bookkeeping themselves, and we avoid having applications pollute the core data model with their specific @@ -202,12 +202,12 @@ easily create a mapping table to do the same thing. The advantage of registering this table as a relation type is that in principle the OpenACS 4 object system could use the meta data in the types table to do useful things -in a generic way on all relation types. But this mechanism doesn't really +in a generic way on all relation types. But this mechanism doesn't really exist yet.
Relation types are a somewhat abstract idea. To get a better feel for them, you should just skip to the data model.
The OpenACS 4 Object Model is designed to generalize and unify the following mechanisms that are repeatedly implemented in OpenACS-based systems to manage generic and application specific metadata:
The presence of a framework for subtyping and inheritance always brings up -the question of why we don't just use an object database. The main reason +the question of why we don't just use an object database. The main reason is that all of the major object database vendors ship products that are effectively tied to some set of object oriented programming languages. Their idea is to provide tight language-level integration to lower the @@ -235,7 +235,7 @@ the relational data model while gaining the object oriented features we need most.
In the context of OpenACS 4, this means using the object model to make our
data models more flexible, so that new modules can easily gain access to
-generic features. However, while the API itself doesn't enforce the idea
+generic features. However, while the API itself doesn't enforce the idea
that applications only use the object model for metadata, it is also the case
that the data model is not designed to scale to large type hierarchies. In
the more limited domain of the metadata model, this is acceptable since the
@@ -319,7 +319,7 @@
by the table_name
of the corresponding object type, although, as
mentioned above, we sometimes store attribute values as key-value pairs in a
"skinny" table. However, when you ask the question "What are
-the attributes of this type of object?", you don't really care about
+the attributes of this type of object?", you don't really care about
how the values for each attribute are stored (in a column or as key-value
pairs); you expect to receive the complete list of all attributes.
The max_n_values
and min_n_values
columns
encode information about the number of values an attribute may hold.
@@ -370,7 +370,7 @@
model, which is discussed next.
The operational level data model centers around the
acs_objects
table. This table contains a single row for every
instance of the type acs_object
. The table contains the
-object's unique identifier, a reference to its type, security
+object's unique identifier, a reference to its type, security
information, and generic auditing information. Here is what the table looks
like:
@@ -395,10 +395,10 @@acs_object_context_index
that stores the context hierarchy.Other tables in the core data model store additional information related to objects. The table
acs_attribute_values
andacs_static_attr_values
are used to store attribute values that -are not stored in a helper table associated with the object's type. The +are not stored in a helper table associated with the object's type. The former is used for instance attributes while the latter is used for class-wide "static" values. These tables have the same basic form, -so we'll only show the first:+so we'll only show the first:create table acs_attribute_values ( object_id not null @@ -431,8 +431,8 @@ type. We do this so we can store all the mapping tables in this one table.
rel_type
is the ID of the relation type to which this object belongs.The next two object IDs are the IDs of the objects being mapped.
All this table does is store one row for every pair of objects that -we'd like to attach with a relation. Any additional attributes that -we'd like to attach to this pair of objects is specified in the +we'd like to attach with a relation. Any additional attributes that +we'd like to attach to this pair of objects is specified in the attributes of the relation type, and could be stored in any number of places. As in the 3.x user/groups system, these places include helper tables or generic skinny tables.
This table, along with acs_attributes
and
@@ -444,9 +444,9 @@
the system. Services can use this table along with the metadata in stored in
the knowledge level data model to create, manage, query and manipulate
objects in a uniform manner. The acs_rels
table has an analogous
-role in storing information on relations.
These are all the tables that we'll discuss in this document. The rest +role in storing information on relations.
These are all the tables that we'll discuss in this document. The rest of the Kernel data model is described in the documents for subsites, the permissions system and for the groups system.
Some examples of how these tables are used in the system can be found in -the discussion of the API, which comes next.
Now we'll examine each piece of the API in detail. Bear in mind that +the discussion of the API, which comes next.
Now we'll examine each piece of the API in detail. Bear in mind that the Object Model API is defined primarily through PL/SQL packages.
The object system provides an API for creating new object types and then
attaching attributes to them. The procedures create_type
and
drop_type
are used to create and delete type definitions.
The two calls show up in the package acs_object_type
.
@@ -578,7 +578,7 @@ with the data model at a lower level.The function
acs_object.new()
makes a new object for you. The functionacs_object.del()
deletes an object. As before, this is an abbreviated interface with all the long type specs removed. See the -data model or developer's guide for the full interface.+data model or developer's guide for the full interface.function new ( object_id in acs_objects.object_id%TYPE default null, @@ -599,8 +599,8 @@
Next, we define some generic functions to manipulate attributes. Again, these interfaces are useful to an extent, but for large scale queries, -it's likely that developers would have to query the data model directly, -and then encapsulate their queries in procedures.
For names, the
default_name
function is used if you don't +it's likely that developers would have to query the data model directly, +and then encapsulate their queries in procedures.For names, the
default_name
function is used if you don't want to define your own name function.function name ( @@ -667,7 +667,7 @@
This function will typically be defined in the context of a PL/SQL -package, but we've left it stand-alone here for simplicity.
To summarize: in order to take advantage of OpenACS 4 services, a new +package, but we've left it stand-alone here for simplicity.
To summarize: in order to take advantage of OpenACS 4 services, a new application need only do three things:
Define a data model to describe application objects. This can just be a normal SQL table.
Create an object type, using code like in the example from the previous section.
Make sure application objects are created using @@ -776,9 +776,9 @@ ); -
In this example, we've made groups a subtype of +
In this example, we've made groups a subtype of
acs_object
to make the code simpler. The actual data model is -somewhat different. Also, we've assumed that there is a helper table +somewhat different. Also, we've assumed that there is a helper table calledgroups
to store information on groups, and that there is a helper table calledgroup_types
that has been defined to store extra attributes on groups.Now, assuming we have another object type called
person
to @@ -851,7 +851,7 @@ end; -The Object Model's API and data model provides a small set of simple procedures that allow applications to create object types, object instances, and object relations. Most of the data model is straightforward; the relation type mechanism is a bit more complex, but in return it provides functionality