• No results found

JBoss Seam Next Generation Integration Framework.

N/A
N/A
Protected

Academic year: 2021

Share "JBoss Seam Next Generation Integration Framework."

Copied!
57
0
0

Loading.... (view fulltext now)

Full text

(1)

JBoss Seam

Next Generation Integration Framework

Melih Sakarya

Melih Sakarya

www.melihsakarya.com

[email protected]

(2)

Seam Framework

JSF

JPA

EJB 3.0

Ajax

Security

SSL

Web Servis

Pojo

Localization

Asynchronous

Remoting

Testing

RichFaces

A4J

Drools

iText PDF

JFreeChart

Facelet

IoC

JBPM

Hibernate

Groovy

Javascript

Hibernate

Testing

GWT

Hibernate Search

Mail

Captcha

JBoss Cache

(3)

Seam Framework

Red Hat

Exadel

JBoss

Hibernate

(4)

Neden Seam

Tümle

ş

ik bir yapı

Hızlı ve kolay geli

ş

tirme ortamı (JBoss Tools)

Açık kaynak

Ücretsiz (LGPL)

Kolay entegrasyon (Spring, IceFaces,

PrimeFaces ...)

Ücretsiz geli

ş

tirme araçları (JBoss Tools)

Kolay test edilebilirlik

(5)
(6)
(7)
(8)

Geli

ş

tirme ortamı

Eclipse

JBoss Tools

Java 1.5 ve üzeri

(9)

Geli

ş

tirme ortamımızı kuralım

http://www.melihsakarya.com/2008/11/jboss-seam-gelistirme-ortami-kurulumu/

(10)

Destekledi

ğ

i Ortamlar

JBoss AS

Websphere AS

OC4J

Weblogic

Tomcat

...

(11)

Seam-gen

Bizim için hazırlanan proje ortamı

Code generation

(12)
(13)

Seam User Interface

Seçenekleri

Facelet

JSF RI

PrimeFaces

Richfaces

Ice Faces

My Faces

...

(14)

JSF-Facelet ve Seam

Template deste

ğ

i

Kolay ve yetenekli EL (Expression Language)

RichFaces

(15)

Seam Component

(16)

Seam Context

Event context

Stateless context

Session context

Conversation context

Application context

Page context

(17)

EJB 3.0

Stateful

Stateles

(18)

EJB tanımı

@Name("loginAction")

@Stateless

public class LoginAction implements Login {

...

(19)

JPA

Annotation ile deklarasyon

@Entity

@Id

...

...

(20)

CRUD Operasyonları

Insert

Update

Delete

(21)

IoC (Inversion of Control)

Injection

Outjection

(22)

Ajax deste

ğ

i

A4J (Ajax for JSF)

(23)

Seam JSF kontrolleri

<h:selectOneMenu value="#{kullanici.sehir}">

<s:selectItems value="#{sehir.resultList}" var="sehir" label="#{sehir.adi}" /> <s:convertEntity />

(24)

Seam JSF kontrolleri

<s:div rendered="#{kullanici.yetki == 1}">

admin alani

(25)

Caching

<s:cache key="blog-#{blog.id}">

<div class="blogEntry">

<h3>#{blog.baslik}</h3>

<div>

<s:formattedText value="#{blog.icerik}"/>

<s:formattedText value="#{blog.icerik}"/>

</div>

</div>

</s:cache>

(26)

Caching

public void post() {

...

entityManager.persist(blogEntry);

pojoCache.remove("anaSayfa", "blog-" + blog.getId() ); }

(27)

EL (Expression Language)

<h:commandButton action="#{kullaniciAction.sil(kullanici)}"

value="Sil"/>

(28)

File upload

<s:fileUpload>

<h:form enctype="multipart/form-data">

<s:fileUpload id="picture" data="#{kayit.resim}"

accept="image/png" contentType="#{kayit.resimContentType}"

accept="image/png" contentType="#{kayit.resimContentType}"

(29)

Security - authentication

<security:identity authenticate-method=

(30)

Authentication

@Name("authenticator") public class Authenticator{

@In Identity identity;

public boolean authenticate() {

if(identity.getUsername().equals("admin") && identity.getPassword().equals("123456")){ identity.getPassword().equals("123456")){ identity.addRole("admin"); return true; } else return false; } }

(31)

Security

<h:outputText value="test" rendered="#{not ide

ntity.loggedIn}">

<h:outputLink action="#{reports.listManagerRe

<h:outputLink action="#{reports.listManagerRe

ports}" rendered="#{s:hasRole('manager')}">

Yönetici

</h:outputLink>

(32)

Security

@Restrict("#{s:hasRole('admin')}")

public void delete() {

...

}

}

(33)

Security

public void deleteCustomer() {

Identity.instance().checkRestriction("#{s:hasPermission('customer ','delete',selectedCustomer)}");

(34)

PDF

<p:document xmlns:p="http://jboss.com/products/seam/pdf" title="Hello"> <p:chapter number="1"> <p:title><p:paragraph>Hello</p:paragraph></p:title> <p:paragraph>Hello </p:paragraph> </p:chapter> </p:chapter> <p:chapter number="2"> <p:title><p:paragraph>Goodbye</p:paragraph></p:title> <p:paragraph>Goodbye.</p:paragraph> </p:chapter> </p:document>

(35)

PDF

Components.xml

<pdf:document-store use-extensions="true" error-page="/pdfMissing.seam" /> xmlns:pdf=http://jboss.com/products/seam/pdf

(36)

PDF

web.xml

<servlet>

<servlet-name>Document Store Servlet</servlet-name>

<servlet-class>org.jboss.seam.pdf.DocumentStoreServlet</servlet-class>

class> </servlet>

<servlet-mapping>

<servlet-name>Document Store Servlet</servlet-name> <url-pattern>*.pdf</url-pattern>

(37)

PDF

WEB-INF\lib\

(38)

Grafik Chart

WEB-INF\lib

jfreechart.jar

(39)

Grafik Chart

<p:piechart title=“Parite" circular="false" direction="anticlockwise" startAngle="30" labelGap="0.1" labelLinkPaint="red">

<p:series key="Prices">

<p:data key="2003" columnKey="2003" value="7.36" /> <p:data key="2004" columnKey="2004" value="11.50" /> <p:data key="2004" columnKey="2004" value="11.50" /> <p:data key="2005" columnKey="2005" value="34.625" /> <p:data key="2006" columnKey="2006" value="76.30" /> <p:data key="2007" columnKey="2007" value="85.05" /> </p:series>

(40)

HTML Grafik Chart

<p:piechart title=“Parite" circular="false" direction="anticlockwise" startAngle="30" labelGap="0.1" labelLinkPaint="red">

<p:series key="Prices">

<p:data key="2003" columnKey="2003" value="7.36" /> <p:data key="2004" columnKey="2004" value="11.50" /> <p:data key="2004" columnKey="2004" value="11.50" /> <p:data key="2005" columnKey="2005" value="34.625" /> <p:data key="2006" columnKey="2006" value="76.30" /> <p:data key="2007" columnKey="2007" value="85.05" /> </p:series>

(41)

Remoting

Seam componentlerine client side eri

ş

im

sa

ğ

lar

DWR benzeri bir mimari sunar

Javascript ile eri

ş

im yapabilirsiniz

(42)

Remoting

<script type="text/javascript"

src="seam/resource/remoting/resource/remote.js"></script>

<s:remote include="test"/>

(43)

Remoting

<script type="text/javascript"> //<![CDATA[

function deneme() {

var name = prompt("Adınız Nedir ?");

Seam.Component.getInstance("test").demo(deneme,demoCallback); }} function deneme(result) { alert(result); } // ]]> </script>

(44)

Remoting

@Stateless

@Name("test")

public class TestAction implements Test {

public String demo(String isim){

return "adınız = " + isim;

return "adınız = " + isim;

}

}

(45)

Remoting

@Local

public interface Test {

@WebRemote

public String demo(String isim);

(46)

Seam Validation

public class Adres { private String sehir;

private String postaKodu; @NotNull

@Length(max=30) @Length(max=30)

public String getSehir() { return sehir; }

public void setSehir(String sehir) { this.sehir = sehir; } @NotNull

@Length(max=6) @Pattern("^\d*$")

public String getPostaKodu() { return postaKodu; }

public void setPostaKodu(String postaKodu) { this.postaKodu = postaKodu; }

(47)

Mail

<m:message xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://jboss.com/products/seam/mail" xmlns:h="http://java.sun.com/jsf/html">

<m:from name="Melih Sakarya" address="[email protected]" /> <m:to name="#{kullanici.ad} #{kullanici.soyad}">#{kullanici.mail}</m:to> <m:to name="#{kullanici.ad} #{kullanici.soyad}">#{kullanici.mail}</m:to> <m:subject>Deneme mesaji</m:subject>

<m:body>

<p>Merhaba #{kullanici.ad},</p> <p>Bu mail seam ile gonderilmistir.

<a href="http://www.melihsakarya.com">www.melihsakarya.com</a></p> </m:body>

(48)

Mail Configuration

components.xml <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:mail="http://jboss.com/products/seam/mail"> <mail:mail-session host="smtp.testsite.com.tr"

password="123456" port="25" username="msakarya" /> </components>

(49)

Mail facelet rendering

@In(create=true)

private Renderer renderer; public void gonder() {

try {

renderer.render("/mailOrnek.xhtml");

facesMessages.add("Email basari ile gonderildi"); }

catch (Exception e) {

facesMessages.add("mesaj gonderilemedi: " + e.getMessage()); }

(50)

Birden çok ki

ş

iye gönderim

<ui:repeat value="#{tumKulanicilar} var="kullanici">

<m:to name="#{kullanici.ad} #{kullanici.soyad}" address="#{kullanici.mail}" />

(51)

Birden çok mail gönderimi

<ui:repeat value="#{kullanicilar}" var="k"> <m:message> <m:from name="#{gonderen.ad} #{gonderen.soyad}">#{gonderen.mail}</m:from> <m:to name="#{k.ad}">#{k.adres}</m:to> ... ... </m:message> </ui:repeat>

(52)

Alternatif mail

<m:body>

<f:facet name="alternative">

Bu maili okuyamıyorsanız www.melihsakarya.com adresini ziyaret ediniz.

</f:facet> </f:facet> </m:body>

(53)

Mail Attachment

<m:attachment value="#{kullanici.foto}"

(54)

Birden çok dosya

<ui:repeat value="#{kullanicilar}" var="kullanici">

<m:attachment value="#{kullanici.foto}" contentType="image/jpeg" fileName="#{kullanici.ad}_#{kullanici.soyad}.jpg"/>

(55)

Mail Pdf Attachment

<m:attachment fileName="test.pdf">

<p:document>

test test test

</p:document>

</m:attachment>

</m:attachment>

(56)

Di

ğ

er email özellikleri

Mail okuma

Farklı header lar ekleme

Internationalisation

(57)

Son

Teşekkürler

References

Related documents

Property Class Code - Enter the three digit numeric code that reflects the property type as it appears on the latest final assessment roll at the time of sale.. If multiple

Sectional Committee (B16) on the Standardization of Pipe Flanges and Fittings was organized in 1921 under the procedure of the American Standards Association (ASA), with the

The present study was aimed to estimate GCA and SCA effects of three testcross populations of pearl millet CSSLs for 15 grain and stover yield-related traits in irrigated (control)

• Tier 1: Individual may request access to customer service (physically or remotely) for themselves and others, order Support Services on behalf of the customer (e.g. Remote

 PFP 4000-Contemporary Issues in Financial Planning  PFP 4370-Personal Financial Planning Capstone  PFP 4375-Financial Planning in the Institutional Setting 

35 The electroanalytical sensing of MDMA/PMA, MDMA and PMA are explored in model (buffer) solutions for the rst time using a range of commercially available electrode substrates

NAMB grants certification status to individuals in the field of mortgage brokerage who meet the established eligibility requirements, complete the application procedure, ascribe to

Dana comes toward us through the servants’ quarters, David close behind, Jeremy in his arms.. Jeremy’s already got his flashlight