Helma Workshop
-
Upload
triotex -
Category
Technology
-
view
492 -
download
2
description
Transcript of Helma Workshop
Helma-WorkshopPhilipp Naderer
ASE-Projekt: Tenezhttp://www.tenez.at
Demo-Distribution
http://tenez.at/downloads/helma-1.6.3-inafara.zip
Helma?
JavaScript Web Application Server
Open Source – BSD-Lizenz
Mozilla Rhino zum Interpretieren
Rhino ist in der J2SE 6 fest verankert
Helma ist anders.
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/
Helma ist anders!Ruby on Rails: Helma:
application \-- models \-- controllers \-- helpers \-- views \-- photographer \-- agency \-- photo
application \-- Photographer |- Photographer.js |- Photographer.actions.js |- Photographer.macros.js |- preview.skin |- main.skin \-- Agency \-- Photo
Helma & JavaRhino ermöglich Zugriff auf Java-Klassen
Zugriff auf alle möglichen Java-Libraries!
Captchas, Chart-Rendering, ...
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());
Request-HandlingIm 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
RenderingrenderSkin(); renderSkinAsString();
Skins: /Prototype/skinname.skin
Macros: bezeichnung_macro(){...}
<li class="taskLine"> <% this.text %> <%// property %> <% this.status %> <%// status_macro() %></li>
DB-MappingFür jeden Prototype mit type.properties# Photographer/type.properties_db = photoworld_table = T_PHOTOGRAPHERS_id = PGR_ID_parent = agency.photographers, root
name = PGR_NAMEbirthday = PGR_BIRTHDAY
address = object(Address)address.local = PGR_ADDRESS_FKaddress.foreign = ADR_ID
photo = collection(Photo)photo.local = PGR_IDphoto.foreign = PHO_PHOTOGRAPHER_FK
REST-URLs/agency/magnum/photographers/philippnaderer
/Agency/type.properties_parent = root.agency
photographers = collection(Photographer)photographers.accessname = photographerUsername
/Root/type.properties
agency = collection(Agency)agency.accessname = agencyAlias
VererbungAlles, 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)
Vererbung
Collections:Sub-Prototypes sind auch in Collections vom Super-Prototype enthalten
allUpdates = collection(Update)allUpdates.local = USR_IDallUpdates.foreign = UPD_CREATOR
StatusUpdate TaskUpdate
Update
Caching
DB
Obj1
Obj2
Obj3
Obj10
Obj11
Obj12
Obj13
Obj14
Obj15
new old
Caching
DB
Obj1
Obj2
Obj3
Obj10
Obj11
Obj12
Obj13
Obj14
Obj15
new old
Obj26
Caching
DB
Obj1
Obj2
Obj3
Obj10
Obj11
Obj12
Obj13
Obj14
Obj15
new old
Obj26
Obj27
Obj28cachesize/2 cachesize/2
cachesize = 12
Caching
DB
Obj1
Obj2
Obj3
new old
Obj26
Obj27
Obj28cachesize/2 cachesize/2
cachesize = 12
Sfârşit
(Ende)