• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Objects, Data And More (OpenACS)
 

Objects, Data And More (OpenACS)

on

  • 2,887 views

Learn when & how to use OpenACS objects

Learn when & how to use OpenACS objects

Statistics

Views

Total Views
2,887
Views on SlideShare
2,860
Embed Views
27

Actions

Likes
0
Downloads
17
Comments
1

4 Embeds 27

http://mark.aufflick.com 20
http://aufflick.com 4
http://www.slideshare.net 2
http://optimus.galileo.edu:8080 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Objects, Data And More (OpenACS) Objects, Data And More (OpenACS) Presentation Transcript

  • OACS Objects, Data & More
    • Develop functional specification
    • Determine inputs, outputs & interaction
    • Design object model & data model
    • Design user interaction
    • Build programming API
    • Build application pages
      • templating system
      • etp applications
  • Determine inputs, outputs & interaction
    • what do we need to take in & store
      • this gives us our fields
    • what do we need to extract & present
      • this gives us our structure
    • BUT - we are not developing a standalone application - our application uses services from the OACS framework
      • we interact in the object model and with the API interfaces
  • OACS Objects
    • How do we decide what should be an object and what can be plain DBMS tables?
    • “ 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”
    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
  • OACS Objects
    • What do we get for this effort?
      • Permissions (the killer benefit)
      • General Comments
      • Content Management
      • etc.
  • Where might we NOT define objects?
    • We might have internal table-based data that does not directly interact with other parts of the system
      • eg. exchage rates
    • We either specifically don’t want them to be available, or if we do we should be exposing them through method calls
  • Defining OACS Object Types
    • object type for Lecturers
      • inherit from the person object type
      • add storage for: faculty, department & office
    • We need to register the new type in acs_object_types
    • acs_attributes anyone?
    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 '’lecturer.name'' -- name_method ); return 0; end;' language 'plpgsql'; select inline_0 (); drop function inline_0 ();
  • Creating the objects
    • Even though we think of our “lecturer object” in OO concepts, it is ultimately stored in a regular relational database table
    • We hide this by creating stored functions that act as creators, destructors and accessors
  • So where do we put all this sql? packages notes … lecturers sql oracle … postgresql lecturers-create.sql lecturers-drop.sql
  • 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
  • What should go in each file?
    • can the sql be expressed in SQL92?
      • index.xql
    • is custom code required for a particular dbms?
      • index-dbms.xql
    • What about inside the tcl file?
  • .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
  • How do I use the xql files?
    • set date [ db_string get_date {} -default 0 ]
    • This is where sql could go. It’s convenient for you … not convenient for someone trying to port your code to another rdbms
  • I changed sql in the tcl file and nothing happened!
    • Look out - many packages have sql inside the tcl db_ function call, but it is overidden by the relevant .xql file
  • I changed sql in the .xql file and nothing happened!
    • Once the .xql file is loaded once by the query processor, it is cached in the server
      • This is good for performance
      • But bad for development
    • 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