migrating to icefaces 2 (spanish)

34
www.icefaces.org | www.mimacom.com Wednesday, March 30, 2011 ICESOFT TECHNOLOGIES INC Slide: 0 ICESOFT TECHNOLOGIES INC www.icefaces.org 2.0 Presentado por

Upload: mimacom-iberica

Post on 18-Nov-2014

7.034 views

Category:

Technology


0 download

DESCRIPTION

Transparencias del Taller de migración a ICEfaces 2. Más información: http://blog.mimacomiberica.es/

TRANSCRIPT

Page 1: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com Wednesday, March 30, 2011

ICESOFT TECHNOLOGIES INC

Slide: 0

ICESOFT TECHNOLOGIES INC www.icefaces.org

2.0

Presentado por

Page 2: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

¡Bienvenidos!

Moderador

Jean-François Clercx CEO Mimacom Ibérica

Presentador

José Antonio Álvarez Software Engineer Mimacom

• Introducciones

• Audio silenciado

• Encuesta

Page 3: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

• Novedades en JSF 2

• Novedades en ICEfaces 2

• Demo: Migración de una aplicación existente de ICEfaces 1.8 a 2.0

• Turno de preguntas y respuestas

Migrando a ICEfaces 2: Agenda

Page 4: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

• La nueva generación para desarrollo JSF AJAX

• Construido sobre JSF 2

• Capa de Compatibilidad

– Permite una adaptación sencilla desde ICEfaces 1.8 y JSF 1.2

– Ofrece los componentes de ICEfaces 1.8 para su uso en JSF 2

• Nuevos componentes

• Configuración más sencilla

• Mejor compatibilidad

• Muchas nuevas características sobre JSF 2

ICEfaces 2

Page 5: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Novedades JSF 2

• AJAX como parte de la arquitectura estándar

- Peticiones Ajax y actualizaciones parciales se integran en el ciclo de vida JSF

• Parte de JEE6

• Facelets se presenta como el estándar

• Desarrollo de componentes más fácil y sencillo con Facelets

• El tráfico se reduce mediante el guardado parcial de estado

• Soporte más amplio para eventos del sistema

JSF 2 aporta muchas mejoras frente a JSF 1.2.

Page 6: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Novedades en JSF 2, cont.

• HTTP GET soportado en el ciclo de vida JSF

• Nuevos ámbitos para beans, y soporte para ámbitos custom

• Anotaciones

• Carga de recursos estandarizada

• Mejora de manejo de excepciones

• Navegación mejorada

• Y más …

JSF 2 aporta muchas mejoras frente a JSF 1.2.

Page 7: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Novedades en ICEfaces 2

• AJAX automático y renderizado Direct-2-DOM

• Single Submit

- Ciclo de vida se ejecuta en un único componente

• AJAX Push

• Bean Management

- Se ofrecen anotaciones que ajustan el comportamiento de beans de ámbito View

• Registro del uso de recursos

• Desarrollo de Portlets con PortletFaces Bridge

• APIs de cliente

- Monitorización de Eventos, envío de formularios, callbacks de eventos y

monitorización de conexión AJAX Push

ICEfaces 2 amplía y simplifica el desarrollo en JSF

2.0

Page 8: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Novedades en ICEfaces 2, cont.

• Configuración simplificada

• Componentes ricos

- ICEfaces Components

- ICEfaces Advanced Components

- ICEfaces Enterprise Components

• Capa de Compatibilidad 1.8

- Actualiza rápidamente tu aplicación ICEfaces 1.8 a 2.0 con cambios menores

• Nuevo Ámbito Window

• Mejora de clustering y tolerancia a fallos

ICEfaces 2 amplía y simplifica el desarrollo en JSF

2.0

Page 9: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Demo: Actualización de aplicación existente

Screen shot

Usando la integración de Eclipse IDE

2.0

Page 10: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

1. Actualización de JSF jars

• jsf-impl.jar: 1.2 – 2.0 (ICEfaces 2.0 viene con Mojarra 2.0.3 FCS)

• jsf-api.jar

2. Actualización de ICEfaces jars

• icefaces.jar: 1.8 – 2.0

• icefaces-comps.jar -> icefaces-ace.jar, icefaces-compat.jar

• nueva librería independiente para AJAX Push: icepush.jar

3. Jars que ya no se necesitan

• backport-util-concurrent.jar

• commons-beanutils.jar

• commons-digester.jar

• commons-el.jar

• commons-fileupload.jar

• icefaces-facelets.jar

Paso 1, configuramos las librerías usadas …

Page 11: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

1. Actualizamos la cabecera de faces-config.xml

• Antigua:

Paso 2, editamos faces-config.xml…

• Nueva:

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"

version="1.2">

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"

version="2.0">

Page 12: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

2. Eliminamos la declaración del Controlador de Vista

• Declaración antigua:

Paso 2, editamos faces-config.xml…

<view-handler>

com.icesoft.faces.facelets.D2DFaceletViewHandler

</view-handler>

Page 13: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

3. Cambiamos los ámbitos de beans:

• El ámbito request ICEfaces se cambia por el nuevo ámbito View

• Ámbito antiguo:

• Nuevo ámbito:

Paso 2, editamos faces-config.xml…

... <managed-bean-scope>request</managed-bean-scope> ...

... <managed-bean-scope>view</managed-bean-scope> ...

Page 14: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

1. Eliminamos los Servlets y mapeos de ICEfaces 1.8:

• ICEfaces 2 se basa ahora en servlets estándar de JSF

• Servlets y mapeos antiguos:

Paso 3, actualización de web.xml…

<servlet>

<servlet-name>Persistent Faces Servlet</servlet-name>

<servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>Persistent Faces Servlet</servlet-name>

</servlet-mapping>

<servlet>

<servlet-name>Blocking Servlet</servlet-name>

<servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>Blocking Servlet</servlet-name>

<url-pattern>/block/*</url-pattern>

</servlet-mapping>

Page 15: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

2. También eliminamos el listener ContextEventRepeater

3. Añadimos el servlet ICEfaces Compat Resources:

• Nuevo servlet y mapeo:

Paso 3, actualización de web.xml…

<servlet>

<servlet-name>Resource Servlet</servlet-name>

<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>Resource Servlet</servlet-name>

<url-pattern>/xmlhttp/*</url-pattern>

</servlet-mapping>

<listener>

<listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>

</listener>

Page 16: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

3. Nos aseguramos que disponemos del Faces Servlet y mapeos:

• Servlet y mapeos:

Paso 3, actualización de web.xml…

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>*.jsf</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>/icefaces/*</url-pattern>

</servlet-mapping>

Page 17: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

3. Cambiamos los parámetros de contexto:

Paso 3, actualización de web.xml…

Parámetros antiguos Nuevos parámetros Valores Por defecto

Antiguo por defecto

facelets.LIBRARIES javax.faces.FACELETS_LIBRARIES

n/a javax.faces.VALIDATE_EMPTY_FIELDS true/false

javax.faces.STATE_SAVING_METHOD Sin cambios server/client

javax.faces.CONFIG_FILES Sin cambios

javax.faces.DEFAULT_SUFFIX Sin cambios *.jsp -> *.xhtml

Page 18: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Cambiamos la extensión *.iface por *.jsf

Paso 4, actualizamos index.jsp

<jsp:forward page="applicantForm.jsf" />

Page 19: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Paso 4, actualizamos los archivos xhtml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:h="http://java.sun.com/jsf/html"

xmlns:f="http://java.sun.com/jsf/core"

xmlns:icecore="http://www.icefaces.org/icefaces/core"

xmlns:ace="http://www.icefaces.org/icefaces/components"

xmlns:ice="http://www.icesoft.com/icefaces/component">

<h:head>

<title>Job Application</title>

<ice:outputStyle href="./xmlhttp/css/xp/xp.css" />

</h:head>

<h:body>

</h:body>

</html>

Page 20: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Paso 4, actualizamos los archivos xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Reemplazamos la <ice:outputDeclaration> por:

Page 21: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Paso 5, cambiamos los componentes que se actualizan

<ace:fileEntry id="resume"

label="File Upload"

relativePath="uploaded"

fileEntryListener="#{resumeUploader.actionListener}"/>

<h:commandButton id="fileUploadButton" value="Upload"/>

<ice:inputFile> se cambia por <ace:fileEntry>

Eliminamos el servlet de subida de ficheros antiguo

<tr>

<td><ice:outputProgress value="#{resumeUploader.fileProgress}"

labelComplete="#{resumeUploader.currentFile.fileName}" /></td>

</tr>

<servlet>

<servlet-name>uploadServlet</servlet-name>

<servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>uploadServlet</servlet-name>

<url-pattern>/uploadHtml</url-pattern>

</servlet-mapping>

Page 22: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Paso 5, cambiamos los componentes que se actualizan

package training.jobapplication.bean.util;

import org.icefaces.component.fileentry.FileEntry;

import org.icefaces.component.fileentry.FileEntryEvent;

import org.icefaces.component.fileentry.FileEntryResults;

public class FileUploader {

private FileEntryResults.FileInfo currentFile;

public FileEntryResults.FileInfo getCurrentFile() {

return currentFile;

}

public void actionListener(FileEntryEvent event) {

FileEntry fileEntry = (FileEntry) event.getSource();

FileEntryResults results = fileEntry.getResults();

for (FileEntryResults.FileInfo fileInfo : results.getFiles()) {

if (fileInfo.isSaved()) {

currentFile = fileInfo;

}

}

}

}

Actualizamos el bean FileUploader

Page 23: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Paso 6, actualización de APIs de Ajax Push

PushRenderer.addCurrentView();

PushRenderer.addCurrentSession();

PushRenderer.render(String);

Llamadas de Ajax Push que se actualizan

RenderManager

OnDemandRenderer

IntervalRenderer

DelayedRenderer

Page 24: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

<navigation-rule>

<from-view-id>/applicantForm.xhtml</from-view-id>

<navigation-case>

<from-outcome>success</from-outcome>

<to-view-id>/thankYou.iface</to-view-id>

</navigation-case>

<navigation-case>

<from-outcome>failure</from-outcome>

<to-view-id>/noThanks.iface</to-view-id>

</navigation-case>

</navigation-rule>

Actualizando de ICEfaces 1.8 a 2.0

Paso 6, actualizamos reglas de navegación de JSF 2

public String submit() {

return "thankYou?faces-redirect=true";

}

Las reglas ya no se necesitan en faces-config.xml

Actualizamos las navegaciones en las páginas .xhtml.

Page 25: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Actualizando de ICEfaces 1.8 a 2.0

Paso 7, cambiamos Partial Submit por Single Submit

<h:form id="applicantForm">

<icecore:singleSubmit/>

Partial Submit todavía funciona pero Single Submit es más eficiente

Page 26: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

¡Muchas Gracias!

A continuación:

• Breve visión de Mimacom

• Turno de preguntas y respuestas

Page 27: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

mimacom

• ¿Qué ofrece mimacom? – Training, Soporte y servicios para los siguientes

frameworks:

– ICEfaces (icefaces.org)

– PortletFaces (portletfaces.org)

– Liferay (liferay.com)

– edoras-framework (edorasframework.org)

– Spring-Framework (springframework.org)

Page 28: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

mimacom

Complete Application Lifecyle Management (ALM) Know-How transfer

edoras path

Methodology

Technology / Frameworks

Tool Chain

Page 29: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

mimacom

Scrum

Page 30: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

mimacom

Toolchain

Development Eclipse (IDE)

Version Control Subversion

Build System Maven 2

Continuous Integration

Bamboo

Issue – Tracker (Requirements, Bugs, Changes, etc.) JIRA

Code R

evie

ws

Cru

cible

Know

ledge-M

ngm

t Confluence

Page 32: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Contacto

ICESOFT TECHNOLOGIES INC

Slide: 31

Contact ICESoft: Toll Free: +1 877 263 3822 USA International: +1 403 663 3322 [email protected]

Contact mimacom: Tel: +34 963524125 [email protected] Skype: jfclercx

Page 33: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Turno de preguntas

• ¿Preguntas? – Por favor escriban sus preguntas en la ventana “Question and Answer” en la

parte inferior derecha de su pantalla

– Las respuestas a las preguntas que no puedan tratarse en esta sesión serán enviadas por correo electrónico

Page 34: Migrating to ICEfaces 2 (Spanish)

www.icefaces.org | www.mimacom.com

Links

• Home: – http://www.icefaces.org

• Forums: – http://www.icefaces.org/JForum/

• ICEpack: – http://www.icefaces.org/main/ajax-java/icepack.iface

• Tutorials: – http://www.icefaces.org/main/resources/tutorials.iface

• Documentation: – http://www.icefaces.org/main/resources/documentation.iface