Successfully reported this slideshow.

Objects, Data And More (OpenACS)



Upcoming SlideShare
OpenACS Workflow
OpenACS Workflow
Loading in …3
1 of 14
1 of 14

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Objects, Data And More (OpenACS)

  1. 1. OACS Objects, Data & More <ul><li>Develop functional specification </li></ul><ul><li>Determine inputs, outputs & interaction </li></ul><ul><li>Design object model & data model </li></ul><ul><li>Design user interaction </li></ul><ul><li>Build programming API </li></ul><ul><li>Build application pages </li></ul><ul><ul><li>templating system </li></ul></ul><ul><ul><li>etp applications </li></ul></ul>
  2. 2. Determine inputs, outputs & interaction <ul><li>what do we need to take in & store </li></ul><ul><ul><li>this gives us our fields </li></ul></ul><ul><li>what do we need to extract & present </li></ul><ul><ul><li>this gives us our structure </li></ul></ul><ul><li>BUT - we are not developing a standalone application - our application uses services from the OACS framework </li></ul><ul><ul><li>we interact in the object model and with the API interfaces </li></ul></ul>
  3. 3. OACS Objects <ul><li>How do we decide what should be an object and what can be plain DBMS tables? </li></ul><ul><li>“ objects are anything represented in the application's data model that will need to be managed by any central service in OpenACS 4.5, or that may be reusable in the context of future applications” </li></ul>acs_objects object_id object_type context_id security_inherit_p creation_user creation_date creation_ip last_modified modifying_user modifying_ip tree_sortkey
  4. 4. OACS Objects <ul><li>What do we get for this effort? </li></ul><ul><ul><li>Permissions (the killer benefit) </li></ul></ul><ul><ul><li>General Comments </li></ul></ul><ul><ul><li>Content Management </li></ul></ul><ul><ul><li>etc. </li></ul></ul>
  5. 5. Where might we NOT define objects? <ul><li>We might have internal table-based data that does not directly interact with other parts of the system </li></ul><ul><ul><li>eg. exchage rates </li></ul></ul><ul><li>We either specifically don’t want them to be available, or if we do we should be exposing them through method calls </li></ul>
  6. 6. Defining OACS Object Types <ul><li>object type for Lecturers </li></ul><ul><ul><li>inherit from the person object type </li></ul></ul><ul><ul><li>add storage for: faculty, department & office </li></ul></ul><ul><li>We need to register the new type in acs_object_types </li></ul><ul><li>acs_attributes anyone? </li></ul>create function inline_0 () returns integer as ' begin PERFORM acs_object_type__create_type ( ’’ lecturer'', -- object_type '’Lecturer'', -- pretty_name '’Lecturers'', -- pretty_plural '’person’' -- supertype '’lecturerss'', -- table_name '’lecturer_id'' -- id_column null, -- package_name ''f'', -- abstract_p null, -- type_extension_table '’'' -- name_method ); return 0; end;' language 'plpgsql'; select inline_0 (); drop function inline_0 ();
  7. 7. Creating the objects <ul><li>Even though we think of our “lecturer object” in OO concepts, it is ultimately stored in a regular relational database table </li></ul><ul><li>We hide this by creating stored functions that act as creators, destructors and accessors </li></ul>
  8. 8. So where do we put all this sql? packages notes … lecturers sql oracle … postgresql lecturers-create.sql lecturers-drop.sql
  9. 9. And what are all these .xql files? Let’s say we have the following files: index.tcl index.xql index-oracle.xql index-postgresql.xql First Second Last
  10. 10. What should go in each file? <ul><li>can the sql be expressed in SQL92? </li></ul><ul><ul><li>index.xql </li></ul></ul><ul><li>is custom code required for a particular dbms? </li></ul><ul><ul><li>index-dbms.xql </li></ul></ul><ul><li>What about inside the tcl file? </li></ul>
  11. 11. .xql file format <?xml version=&quot;1.0&quot;?> <queryset> <rdbms><type>postgresql</type><version>7.1</version></rdbms> <fullquery name=&quot;get_date&quot;> <querytext> select to_char(creation_date, 'DD/MM/YYYY') from acs_objects where object_id = :response_id </querytext> </fullquery> </queryset> Rdbms line not used In the default .xql file
  12. 12. How do I use the xql files? <ul><li>set date [ db_string get_date {} -default 0 ] </li></ul><ul><li>This is where sql could go. It’s convenient for you … not convenient for someone trying to port your code to another rdbms </li></ul>
  13. 13. I changed sql in the tcl file and nothing happened! <ul><li>Look out - many packages have sql inside the tcl db_ function call, but it is overidden by the relevant .xql file </li></ul>
  14. 14. I changed sql in the .xql file and nothing happened! <ul><li>Once the .xql file is loaded once by the query processor, it is cached in the server </li></ul><ul><ul><li>This is good for performance </li></ul></ul><ul><ul><li>But bad for development </li></ul></ul><ul><li>You need to go to the package manager (acs-admin/apm), click on your package, click on manage files, and set your .xql file to be watched </li></ul>

Editor's Notes