The Spring of Adobe Flex Remoting

15
® Copyright 2008 Adobe Systems Incorporated. All rights reserved. The Spring of Adobe Flex Remoting http://www.flickr.com/photos/wisdoc/431285814/

description

Flex Remoting Spring Security Exception Service Java

Transcript of The Spring of Adobe Flex Remoting

Page 1: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

The Spring of Adobe Flex Remoting

http://www.flickr.com/photos/wisdoc/431285814/

Page 2: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

François Le Droff

“Just another Java guy”Adobe Technology and Service Innovation

10 ans d’expérience (web 1+n.0)

OSS geek :

contributeur sur qsos, xradar , leader du projetfna,

membre de l’ossgtp, du ParisJUG, et ParisJBUG

conférencier à MAX, et Solution Linux

blogs : http://www.droff.comhttp://blogs.adobe.com/francoisledroff/

[email protected]

Page 3: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Spring & Flex Remoting

Spring & Flex :Avant : SpringFactory

Maintenant : Spring-flex 1.0.0-RELEASE

http://www.springsource.org/spring-flex

LCDS Spring : à suivre…

Page 4: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Flex Remoting

http://blog.xebia.fr/2008/09/16/blazeds/

Page 5: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Spring et Flex Remoting

Par défaut, « Flex Remoting » instancie et de gére le cycle de vie des remoteobjects définis dans le fichier de configuration remoting-config.xml.

La philosophie de Spring IoC est de laisser le conteneur instancier les composants ( et d’injecter leurs dépendances).

La clef d’intégration de Spring et « Flex Remoting » , donc, est de trouver le meilleur moyen d’exposer des « Flex Remoting » services , tout en laissant le conteneur Spring gérer la configuration, la sécurité, l’instanciation, et le cycle de vie des implémentation (legacy ou pas) des ces services.

Page 6: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Flex Remoting + Spring Factory

Page 7: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Ancienne approche: Spring factory

Le rôle de la factory est de fournir des instances d’objets prêts à l’emploi à BlazeDS, plutôt que de laisser BlazeDS instancier les composants. Pour créer une factory, il faut créer une classes qui implémente l’interface flex.messaging.FlexFactory, et implémenter la méthode lookup() utilisée par BlazeDS pour obtenir une instance d’un remote object.

Enregistrer la factory Spring dans le fichier de configuration services-config.xml :

1.<factories>

2.<factory id="spring" class="flex.samples.factories.SpringFactory"/>

3.</factories>

Configurer la destination pour qu’elle utilise la factory:

1.<destination id="myService">

2.<properties>

3.<factory>spring</factory>

4.<source>myBean</source>

5.</properties>

6.</destination>

Page 8: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Spring-Factory: Les limites

L’approche par lookup de dépendances décrites ci-dessus est en désaccord avec l’approche de Spring (injection de dépendance).

Les objets doivent être configurés deux fois : une première fois dans le fichier remoting-config.xml de BlazeDS, et une fois de plus dans le fichier Spring de contexte de l’application.

L’intégration se limite à du remoting basique et ne couvre pas d’autres aspects importants comme la sécurité et le messaging.

Page 9: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Spring-Flex

Spring

AM

F Broker

Spring

Service

Page 10: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Spring-Flex : Projet d’intégration avec SpringSource

Le MessageBroker, clef de voute du moteur de LCDS, est configuré comme un bean géré par Spring et n’a plus besoin d’être configuré dans le fichier web.xml

Les messages Flex sont routés vers le MessageBroker à travers le DispatcherServlet de Spring

Les RemoteObjects sont configurés « à la de Spring »

Intégration de

Spring Security

« Exception translators »

Page 11: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Spring-FlexDemo

& Revue de Code :

http://fna.googlecode.com/svn/trunk/fna/samples/riveria_jug/spring_flex_todo/http://www.gnu.org/licenses/lgpl.html

Page 12: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

A few magic details : Spring AutoWiring

With a simple SpringFactory (and/or JavaAdapter) approach, you need to configure each new Java remote object service in remoting-config.xml.

@RemotingDestination (JDK5 annotation) allows you to autowire Spring beans directly into BlazeDS.

Page 13: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

A few magic details : Application Context

Page 14: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

client side

Page 15: The Spring of Adobe Flex Remoting

®

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Questions ?