Helma Workshop

599 views
571 views

Published on

My presentation for the JSUG at the TU Vienna.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
599
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Helma Workshop

  1. 1. Helma-Workshop Philipp Naderer ASE-Projekt: Tenez http://www.tenez.at philipp.naderer@tenez.at
  2. 2. Demo-Distribution http://tenez.at/downloads/helma-1.6.3-inafara.zip
  3. 3. Helma? JavaScript Web Application Server Open Source – BSD-Lizenz Mozilla Rhino zum Interpretieren Rhino ist in der J2SE 6 fest verankert Helma ist anders.
  4. 4. Helma ist anders! Prototyp-basiertes Objekthandling Ganz grob gesagt: Prototype = Klasse Prototypen bestimmen Applikations-Layout REST-konform - jeder Ressource wird eine URL zugeordnet. /photographers/leibovitz/
  5. 5. Helma ist anders! Ruby on Rails: Helma: application application -- models -- Photographer -- controllers |- Photographer.js |- Photographer.actions.js -- helpers |- Photographer.macros.js -- views |- preview.skin -- photographer |- main.skin -- agency -- Agency -- photo -- Photo
  6. 6. Helma & Java Rhino ermöglich Zugriff auf Java-Klassen var url = new java.net.URL('http://orf.at‘); var host = url.getHost(); var bigInt = new java.math.BigInteger('1000000‘); res.write('Next prime: ' + bigInt.nextProbablePrime()); Zugriff auf alle möglichen Java-Libraries! Captchas, Chart-Rendering, ...
  7. 7. Request-Handling Im Prototypen eine Funktion: ProtoName.prototype.methodenname_action() Wird gemapped auf: /objektId/methodenname Photo.prototype.delete_action = function() { // Request-Objekte: req res session root } URL: /leibovitz/photos/1024/delete
  8. 8. Rendering renderSkin(); renderSkinAsString(); Skins: /Prototype/skinname.skin Macros: bezeichnung_macro(){...} <li class="taskLine"> <% this.text %> <%// property %> <% this.status %> <%// status_macro() %> </li>
  9. 9. DB-Mapping Für jeden Prototype mit type.properties # Photographer/type.properties _db = photoworld _table = T_PHOTOGRAPHERS _id = PGR_ID _parent = agency.photographers, root name = PGR_NAME birthday = PGR_BIRTHDAY address = object(Address) address.local = PGR_ADDRESS_FK address.foreign = ADR_ID photo = collection(Photo) photo.local = PGR_ID photo.foreign = PHO_PHOTOGRAPHER_FK
  10. 10. REST-URLs /agency/magnum/photographers/philippnaderer /Root/type.properties agency = collection(Agency) agency.accessname = agencyAlias /Agency/type.properties _parent = root.agency photographers = collection(Photographer) photographers.accessname = photographerUsername
  11. 11. Vererbung Alles, was für den Super-Prototypen definiert wird, erbt der Sub-Prototype. Konstruktoren, Methoden, type.properties _extends = SuperPrototypeName Optional, aber üblich: Sub-Prototypen in selbe Datenbank-Tabelle ablegen # Dog/type.properties _extends = Animal _prototype = ANI_PROTOTYPE_NAME _extensionId = Dog (String oder frei wählbarer Integer)
  12. 12. Vererbung Collections: Sub-Prototypes sind auch in Collections vom Super-Prototype enthalten allUpdates = collection(Update) allUpdates.local = USR_ID allUpdates.foreign = UPD_CREATOR Update StatusUpdate TaskUpdate
  13. 13. Caching Obj1 Obj10 Obj2 Obj11 Obj3 Obj12 DB Obj13 Obj14 Obj15 new old
  14. 14. Caching Obj1 Obj10 Obj2 Obj11 Obj3 Obj12 DB Obj26 Obj13 Obj14 Obj15 new old
  15. 15. Caching Obj1 Obj10 Obj2 Obj11 Obj3 Obj12 DB Obj26 Obj13 Obj27 Obj14 Obj28 Obj15 cachesize/2 cachesize/2 cachesize = 12 new old
  16. 16. Caching Obj1 Obj2 Obj3 DB Obj26 Obj27 Obj28 cachesize/2 cachesize/2 cachesize = 12 new old
  17. 17. Sfârşit (Ende)

×