helma workshop

17
Helma-Workshop Philipp Naderer ASE-Projekt: Tenez http://www.tenez.at [email protected]

Upload: triotex

Post on 10-May-2015

495 views

Category:

Technology


2 download

DESCRIPTION

My presentation for the JSUG at the TU Vienna.

TRANSCRIPT

Page 1: Helma Workshop

Helma-WorkshopPhilipp Naderer

ASE-Projekt: Tenezhttp://www.tenez.at

[email protected]

Page 2: Helma Workshop

Demo-Distribution

http://tenez.at/downloads/helma-1.6.3-inafara.zip

Page 3: Helma Workshop

Helma?

JavaScript Web Application Server

Open Source – BSD-Lizenz

Mozilla Rhino zum Interpretieren

Rhino ist in der J2SE 6 fest verankert

Helma ist anders.

Page 4: Helma Workshop

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/

Page 5: Helma Workshop

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

Page 6: Helma Workshop

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());

Page 7: Helma Workshop

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

Page 8: Helma Workshop

RenderingrenderSkin(); renderSkinAsString();

Skins: /Prototype/skinname.skin

Macros: bezeichnung_macro(){...}

<li class="taskLine"> <% this.text %> <%// property %> <% this.status %> <%// status_macro() %></li>

Page 9: Helma Workshop

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

Page 10: Helma Workshop

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

Page 11: Helma Workshop

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)

Page 12: Helma Workshop

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

Page 13: Helma Workshop

Caching

DB

Obj1

Obj2

Obj3

Obj10

Obj11

Obj12

Obj13

Obj14

Obj15

new old

Page 14: Helma Workshop

Caching

DB

Obj1

Obj2

Obj3

Obj10

Obj11

Obj12

Obj13

Obj14

Obj15

new old

Obj26

Page 15: Helma Workshop

Caching

DB

Obj1

Obj2

Obj3

Obj10

Obj11

Obj12

Obj13

Obj14

Obj15

new old

Obj26

Obj27

Obj28cachesize/2 cachesize/2

cachesize = 12

Page 16: Helma Workshop

Caching

DB

Obj1

Obj2

Obj3

new old

Obj26

Obj27

Obj28cachesize/2 cachesize/2

cachesize = 12

Page 17: Helma Workshop

Sfârşit

(Ende)