SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
SEAM ON GLASSFISH
   A SLIDECAST

      DAN ALLEN
  JBOSS, A DIVISION OF RED HAT
package org.example.vehicles.action;

import javax.ejb.Remove;...

@Stateful
@Name(quot;vehicleTradequot;)
public class VehicleTradeBean implements VehicleTrade
{
    @Logger private Log log;

    @In FacesMessages facesMessages;

    private String value;

    public void trade()
    {
        log.info(quot;vehicleTrade.trade() action called with: #{vehicleTrade.value}quot;);
        facesMessages.add(quot;trade #{vehicleTrade.value}quot;);
    }

    @Length(max = 10)
    public String getValue()
    {
        return value;
    }

    public void setValue(String value)
    {
        this.value = value;
    }

    @Destroy @Remove
    public void destroy() {}

}
package org.example.vehicles.action;

import javax.ejb.Stateless;...

@Stateless
@Name(quot;authenticatorquot;)
public class AuthenticatorBean implements Authenticator
{
    @Logger private Log log;

    @In Identity identity;
    @In Credentials credentials;

    public boolean authenticate()
    {
        log.info(quot;authenticating {0}quot;, credentials.getUsername());
        //write your authentication logic here,
        //return true if the authentication was
        //successful, false otherwise
        if (quot;adminquot;.equals(credentials.getUsername()))
        {
            identity.addRole(quot;adminquot;);
            return true;
        }
        return false;
    }

}
/build.properties

jboss.home = /home/dallen/opt/jboss-as
jboss.domain = default
glassfish.home = /home/dallen/opt/glassfish-v2
glassfish.domain = domain1

                                                 Tells script which GlassFish
                                                 installation to target.
Adding GlassFish targets

  Define in separate Ant build file
  –   glassfish.build.xml
  Prefix targets to avoid naming conflict
  –   prefix: “gf-”
  Import into build.xml (before first target)
<import file=quot;${basedir}/glassfish.build.xmlquot;/>
asadmin macro
<macrodef name=quot;asadminquot;>
    <attribute name=quot;cmdquot;/>
    <attribute name=quot;argsquot; default=quot;quot;/>
    <attribute name=quot;logquot; default=quot;truequot;/>
    <element name=quot;pre-conditionsquot; optional=quot;truequot;/>
    <sequential>
        <fail unless=quot;glassfish.homequot;>glassfish.home not set</fail>
        <pre-conditions/>
        <exec executable=quot;${glassfish.home}/bin/asadminquot;>
            <arg value=quot;@{cmd}quot;/>
            <arg line=quot;@{args}quot;/>
            <redirector outputproperty=quot;gf.cmd.outputquot; alwayslog=quot;@{log}quot;/>
        </exec>
    </sequential>
</macrodef>
Using the asadmin macro

  Starting the server
<asadmin cmd=quot;start-domainquot; args=quot;${glassfish.domain}quot;>
    <pre-conditions>
        <fail unless=quot;glassfish.domainquot;>glassfish.domain not set</fail>
    </pre-conditions>
</asadmin>


  Stopping the server
<asadmin cmd=quot;stop-domainquot; args=quot;${glassfish.domain}quot;>
    <pre-conditions>
        <fail unless=quot;glassfish.domainquot;>glassfish.domain not set</fail>
    </pre-conditions>
</asadmin>


  Registering a data source
<asadmin cmd=quot;add-resourcesquot;
    args=quot;${basedir}/resources/glassfish-resources-${profile}.xmlquot;/>
<target name=quot;gf-deploy-hibernatequot;
    description=quot;Deploys Hibernate to be a JPA provider on GlassFishquot;>
    <fail unless=quot;glassfish.homequot;>glassfish.home not set</fail>
    <fail unless=quot;glassfish.domainquot;>glassfish.domain not set</fail>
    <copy todir=quot;${glassfish.home}/domains/${glassfish.domain}/lib/extquot;>
        <fileset dir=quot;${basedir}/libquot;>
            <include name=quot;antlr.jarquot;/>
            <include name=quot;asm.jarquot;/>
            <include name=quot;asm-attrs.jarquot;/>
            <include name=quot;cglib.jarquot;/>
            <include name=quot;commons-collections.jarquot;/>
            <include name=quot;commons-logging.jarquot;/>
            <include name=quot;concurrent.jarquot;/>
            <include name=quot;dom4j.jarquot;/>
            <include name=quot;hibernate.jarquot;/>
            <include name=quot;hibernate-*.jarquot;/>
            <exclude name=quot;hibernate-search.jarquot;/>
            <include name=quot;javassist.jarquot;/>
            <include name=quot;jboss-common-core.jarquot;/>
            <include name=quot;jta.jarquot;/>
            <include name=quot;persistence-api.jarquot;/>
            <include name=quot;mysql-connector-java-5.1.6.jarquot;/>
        </fileset>
    </copy>
</target>
/resources/META-INF/persistence-dev.xml

<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<persistence>
    <persistence-unit name=quot;vehicleseequot;>
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>vehicleseeDatasource</jta-data-source>
        <properties>
            ...
            <property name=quot;hibernate.transaction.manager_lookup_classquot;
                value=quot;@transactionManagerLookupClass@quot; />
        </properties>
    </persistence-unit>
</persistence>
                                                                  Strip proprietary JNDI
                                                                  prefix java:/
/resources/vehiclesee-dev-ds.xml

<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<datasources>
   <local-tx-datasource>
      <jndi-name>vehicleseeDatasource</jndi-name>
      <use-java-context>false</use-java-context>
      <connection-url>jdbc:mysql://localhost/vehicles</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>dallen</user-name>
      <password>dallen</password>
   </local-tx-datasource>
</datasources>
/resources/glassfish-resources-dev.xml

<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<resources>

   <jdbc-connection-pool
       name=quot;vehicleseePoolquot;
       datasource-classname=quot;com.mysql.jdbc.jdbc2.optional.MysqlDataSourcequot;
       res-type=quot;javax.sql.DataSourcequot;>
       <property name=quot;userquot; value=quot;dallenquot;/>
       <property name=quot;passwordquot; value=quot;dallenquot;/>
       <property name=quot;urlquot; value=quot;jdbc:mysql://localhost/vehiclesquot;/>
   </jdbc-connection-pool>

   <jdbc-resource                                             Uses DataSource rather
       jndi-name=quot;vehicleseeDatasourcequot;                       than JDBC driver
       pool-name=quot;vehicleseePoolquot;
       enabled=quot;truequot;
       object-type=quot;userquot;/>

</resources>
                                    JNDI name referenced           GlassFish Admin Console
                                    in persistence.xml
/build.xml (top of jar target)

<!-- defaults, can be overridden in preceding target or from commandline flag -->
<property name=quot;ejbJndiPatternquot; value=quot;${project.name}/#{ejbName}/localquot;/>
<property name=quot;transactionManagerLookupClassquot;
    value=quot;org.hibernate.transaction.SunONETransactionManagerLookupquot;/>

                                                               Token replacements for
                                                               components.properties
<filterset id=quot;seamquot;>
    <filter token=quot;ejbJndiPatternquot; value=quot;${ejbJndiPattern}quot;/>
    <filter token=quot;seamBootstrapPuquot; value=quot;${seamBootstrapPu}quot;/>
    <filter token=quot;seamEmfquot; value=quot;${seamEmf}quot;/>
    <filter token=quot;puJndiNamequot; value=quot;${puJndiName}quot;/>
</filterset>

                                                               Token replacements for
                                                               persistence.xml
<filterset id=quot;persistencequot;>
    <filter token=quot;transactionManagerLookupClassquot; value=quot;${transactionManagerLookupClass}quot;/>
</filterset>
/build.xml (jar target)

<copy tofile=quot;${jar.dir}/META-INF/persistence.xmlquot;
    file=quot;${basedir}/resources/META-INF/persistence-${profile}.xmlquot;
    overwrite=quot;truequot;>
    <filterset refid=quot;persistencequot;/>
</copy>
                                                             Apply token replacements


/build.xml (war target)

<copy tofile=quot;${war.dir}/WEB-INF/classes/components.propertiesquot;
    file=quot;${basedir}/resources/components-${profile}.propertiesquot;
    overwrite=quot;truequot;>
    <filterset refid=quot;seamquot;/>
</copy>
/resources/WEB-INF/components.xml

<components xmlns=quot;http://jboss.com/products/seam/componentsquot;
    ...
    xmlns:persistence=quot;http://jboss.com/products/seam/persistencequot;
    xsi:schemaLocation=quot;
        ...
        http://jboss.com/products/seam/persistence
        http://jboss.com/products/seam/persistence-2.1.xsdquot;>

   <persistence:entity-manager-factory name=quot;entityManagerFactoryquot;
       persistence-unit-name=quot;vehicleseequot;/>

   <persistence:managed-persistence-context name=quot;entityManagerquot;
       entity-manager-factory=quot;#{entityManagerFactory}quot; auto-create=quot;truequot;/>

</components>


                                              Seam bootstraps persistence unit ==
                                              application-managed persistence
/resources/WEB-INF/components.xml

<components xmlns=quot;http://jboss.com/products/seam/componentsquot;
    ...
    xmlns:tx=quot;http://jboss.com/products/seam/transactionquot;
    xsi:schemaLocation=quot;
        ...
        http://jboss.com/products/seam/transaction
        http://jboss.com/products/seam/transaction-2.1.xsdquot;>

   <tx:ejb-transaction/>

</components>

                                  Allows Seam to pass along transaction synchronization
                                  events to other Seam components.

                                  Before completion:

                                  - org.jboss.seam.beforeTransactionCompletion

                                  After successful completion:

                                  - org.jboss.seam.afterTransactionCompletion(true)

                                  After transaction failure:

                                  - org.jboss.seam.afterTransactionCompletion(false)
/build.xml

<copy tofile=quot;${war.dir}/WEB-INF/classes/components.propertiesquot;
    file=quot;${basedir}/resources/components-${profile}.propertiesquot;>
    <filterset refid=quot;seamquot;/>
</copy>
                                                +     /resources/components-dev.properties

                                                      jndiPattern=@ejbJndiPattern@




                         /WEB-INF/classes/components.properties

                         jndiPattern=java:comp/env/vehiclesee/#{ejbName}/local




                         /WEB-INF/components.xml

                         <components>
                             <core:init jndiPattern=quot;@jndiPattern@quot;/>
                         </compoennts>
/resources/WEB-INF/web.xml (end of file)

<ejb-local-ref>
    <ejb-ref-name>vehiclesee/EjbSynchronizations/local</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home/>
    <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
</ejb-local-ref>

<ejb-local-ref>
    <ejb-ref-name>vehiclesee/AuthenticatorBean/local</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home/>
    <local>org.example.vehicles.action.Authenticator</local>
</ejb-local-ref>

<ejb-local-ref>
    <ejb-ref-name>vehiclesee/VehicleTradeBean/local</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home/>
    <local>org.example.vehicles.action.VehicleTrade</local>
</ejb-local-ref>
/build.xml (war target)

<target name=quot;warquot; ...>
    ...
        <fileset dir=quot;${basedir}/viewquot;>
            <include name=quot;**/*.xcssquot;/>
        </fileset>
        <fileset dir=quot;${basedir}/resourcesquot;>   Add fileset to copy the provided theme
            <include name=quot;**/*.xcssquot;/>
                                               resource (theme.xcss) to the classpath
        </fileset>
    ...                                        to workaround bug in RichFaces with
</target>                                      GlassFish.
Achieving hot deploy

jboss-seam.jar must be exploded since it
contains an EJB
–   Deploy exploded EAR from staging area
–   gf-explode uses “adadmin deploydir”
Run staging target
–   gf-hotdeploy runs “ant stage”
Seam's hot deploy classloader works!
–   The catch: only works with a WAR, not an EAR
Container-managed persistence

Persistence unit must be deployed in a
separate JAR
JAR must be in EAR lib directory and
cannot be exploded
Requires additional configuration in
components.xml, persistence.xml, and
web.xml
Allows you to use @PersistenceContext
Commands to develop by
gf-start - Starts GlassFish
gf-stop - Stops GlassFish
gf-restart - Restarts GlassFish
gf-datasource - Registers the datasource and connection pool for the
profile
gf-explode - Deploys the exploded archive to GlassFish (initial)
gf-hotdeploy - Hot deploys Java classes and components (exploded only)
gf-deploy - Deploys the packaged archive to GlassFish
gf-undeploy - Undeploys the exploded or packaged archive from GlassFish
gf-deploy-hibernate - Deploys Hibernate as a JPA provider to GlassFish

Contenu connexe

Tendances

Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)
Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)
Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)Wim Godden
 
Creating fast, dynamic ACLs in Zend Framework
Creating fast, dynamic ACLs in Zend FrameworkCreating fast, dynamic ACLs in Zend Framework
Creating fast, dynamic ACLs in Zend FrameworkWim Godden
 
New methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsNew methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsMikhail Egorov
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyMark Meeker
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Introduction into Struts2 jQuery Grid Tags
Introduction into Struts2 jQuery Grid TagsIntroduction into Struts2 jQuery Grid Tags
Introduction into Struts2 jQuery Grid TagsJohannes Geppert
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your projectMichelangelo van Dam
 
Building High Performance Web Applications and Sites
Building High Performance Web Applications and SitesBuilding High Performance Web Applications and Sites
Building High Performance Web Applications and Sitesgoodfriday
 
Hide Versus Expose
Hide Versus ExposeHide Versus Expose
Hide Versus ExposeLiquidHub
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsMichelangelo van Dam
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)Ajay Khatri
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationguest5d87aa6
 
Introduction to PHP Lecture 1
Introduction to PHP Lecture 1Introduction to PHP Lecture 1
Introduction to PHP Lecture 1Ajay Khatri
 

Tendances (20)

Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)
Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)
Creating fast, dynamic ACLs in Zend Framework (Zend Webinar)
 
Creating fast, dynamic ACLs in Zend Framework
Creating fast, dynamic ACLs in Zend FrameworkCreating fast, dynamic ACLs in Zend Framework
Creating fast, dynamic ACLs in Zend Framework
 
New methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applicationsNew methods for exploiting ORM injections in Java applications
New methods for exploiting ORM injections in Java applications
 
Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet
 
前端概述
前端概述前端概述
前端概述
 
Os Harris
Os HarrisOs Harris
Os Harris
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Introduction into Struts2 jQuery Grid Tags
Introduction into Struts2 jQuery Grid TagsIntroduction into Struts2 jQuery Grid Tags
Introduction into Struts2 jQuery Grid Tags
 
QA for PHP projects
QA for PHP projectsQA for PHP projects
QA for PHP projects
 
Zend framework 04 - forms
Zend framework 04 - formsZend framework 04 - forms
Zend framework 04 - forms
 
Zend Framework
Zend FrameworkZend Framework
Zend Framework
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your project
 
Building High Performance Web Applications and Sites
Building High Performance Web Applications and SitesBuilding High Performance Web Applications and Sites
Building High Performance Web Applications and Sites
 
Hide Versus Expose
Hide Versus ExposeHide Versus Expose
Hide Versus Expose
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
Os Leonard
Os LeonardOs Leonard
Os Leonard
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Introduction to PHP Lecture 1
Introduction to PHP Lecture 1Introduction to PHP Lecture 1
Introduction to PHP Lecture 1
 

En vedette

Ejemplo Matematicas Slideshare2
Ejemplo Matematicas Slideshare2Ejemplo Matematicas Slideshare2
Ejemplo Matematicas Slideshare2aliende
 
Imagina
ImaginaImagina
Imaginagufg
 
Ayatli Linea De Accion 1
Ayatli Linea De Accion 1Ayatli Linea De Accion 1
Ayatli Linea De Accion 1saidnacif
 

En vedette (6)

Slideshare
SlideshareSlideshare
Slideshare
 
Ejemplo Matematicas Slideshare2
Ejemplo Matematicas Slideshare2Ejemplo Matematicas Slideshare2
Ejemplo Matematicas Slideshare2
 
Keynote Globs
Keynote GlobsKeynote Globs
Keynote Globs
 
Imagina
ImaginaImagina
Imagina
 
Letter Written In 2070
Letter Written In 2070Letter Written In 2070
Letter Written In 2070
 
Ayatli Linea De Accion 1
Ayatli Linea De Accion 1Ayatli Linea De Accion 1
Ayatli Linea De Accion 1
 

Similaire à SEAM ON GLASSFISH

Solr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsSolr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsWildan Maulana
 
Extending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorExtending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorMark Leith
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в MagentoMagecom Ukraine
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing frameworkIndicThreads
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax componentsIgnacio Coloma
 
Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09helggeist
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationDavid Calavera
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...Kirill Chebunin
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone InteractivityEric Steele
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!Greg Bell
 
Ajax On S2 Odp
Ajax On S2 OdpAjax On S2 Odp
Ajax On S2 Odpghessler
 
Struts2
Struts2Struts2
Struts2yuvalb
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching ResurrectedBen Scofield
 

Similaire à SEAM ON GLASSFISH (20)

Solr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsSolr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJs
 
Extending MySQL Enterprise Monitor
Extending MySQL Enterprise MonitorExtending MySQL Enterprise Monitor
Extending MySQL Enterprise Monitor
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementation
 
Javascript Basic
Javascript BasicJavascript Basic
Javascript Basic
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
Spring 2.0
Spring 2.0Spring 2.0
Spring 2.0
 
Spring 2.0
Spring 2.0Spring 2.0
Spring 2.0
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!
 
Ajax On S2 Odp
Ajax On S2 OdpAjax On S2 Odp
Ajax On S2 Odp
 
Struts2
Struts2Struts2
Struts2
 
Introduction to JQuery
Introduction to JQueryIntroduction to JQuery
Introduction to JQuery
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
Alfresco Search Internals
Alfresco Search InternalsAlfresco Search Internals
Alfresco Search Internals
 

Plus de Eduardo Pelegri-Llopart

Pelegri Desarrollando en una nueva era de software
Pelegri   Desarrollando en una nueva era de software Pelegri   Desarrollando en una nueva era de software
Pelegri Desarrollando en una nueva era de software Eduardo Pelegri-Llopart
 
Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Eduardo Pelegri-Llopart
 
The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015Eduardo Pelegri-Llopart
 
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...Eduardo Pelegri-Llopart
 
What is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouWhat is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouEduardo Pelegri-Llopart
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEduardo Pelegri-Llopart
 

Plus de Eduardo Pelegri-Llopart (20)

Juggling at freenome
Juggling   at freenomeJuggling   at freenome
Juggling at freenome
 
Csumb capstone-fall2016
Csumb capstone-fall2016Csumb capstone-fall2016
Csumb capstone-fall2016
 
Digital activitymanagement
Digital activitymanagementDigital activitymanagement
Digital activitymanagement
 
Progress next iot_pelegri
Progress next iot_pelegriProgress next iot_pelegri
Progress next iot_pelegri
 
Pelegri Desarrollando en una nueva era de software
Pelegri   Desarrollando en una nueva era de software Pelegri   Desarrollando en una nueva era de software
Pelegri Desarrollando en una nueva era de software
 
Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015
 
The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015
 
IOT - Presentation to PEP @ Progress
IOT - Presentation to PEP @ ProgressIOT - Presentation to PEP @ Progress
IOT - Presentation to PEP @ Progress
 
Node.js as an IOT Bridge
Node.js as an IOT BridgeNode.js as an IOT Bridge
Node.js as an IOT Bridge
 
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
 
What is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouWhat is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts You
 
Community Update 25 Mar2010 - English
Community Update 25 Mar2010 - EnglishCommunity Update 25 Mar2010 - English
Community Update 25 Mar2010 - English
 
GlassFish Community Update 25 Mar2010
GlassFish Community Update 25 Mar2010GlassFish Community Update 25 Mar2010
GlassFish Community Update 25 Mar2010
 
Glass Fish Portfolio C1 West V3.Mini
Glass Fish Portfolio C1 West V3.MiniGlass Fish Portfolio C1 West V3.Mini
Glass Fish Portfolio C1 West V3.Mini
 
Virtual Box Aquarium May09
Virtual Box Aquarium May09Virtual Box Aquarium May09
Virtual Box Aquarium May09
 
Introduction To Web Beans
Introduction To Web BeansIntroduction To Web Beans
Introduction To Web Beans
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage Patterns
 
OpenDS Primer Aquarium
OpenDS Primer AquariumOpenDS Primer Aquarium
OpenDS Primer Aquarium
 
Fuji Overview
Fuji OverviewFuji Overview
Fuji Overview
 
Nuxeo 5.2 Glassfish
Nuxeo 5.2 GlassfishNuxeo 5.2 Glassfish
Nuxeo 5.2 Glassfish
 

Dernier

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Dernier (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

SEAM ON GLASSFISH

  • 1. SEAM ON GLASSFISH A SLIDECAST DAN ALLEN JBOSS, A DIVISION OF RED HAT
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. package org.example.vehicles.action; import javax.ejb.Remove;... @Stateful @Name(quot;vehicleTradequot;) public class VehicleTradeBean implements VehicleTrade { @Logger private Log log; @In FacesMessages facesMessages; private String value; public void trade() { log.info(quot;vehicleTrade.trade() action called with: #{vehicleTrade.value}quot;); facesMessages.add(quot;trade #{vehicleTrade.value}quot;); } @Length(max = 10) public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Destroy @Remove public void destroy() {} }
  • 7. package org.example.vehicles.action; import javax.ejb.Stateless;... @Stateless @Name(quot;authenticatorquot;) public class AuthenticatorBean implements Authenticator { @Logger private Log log; @In Identity identity; @In Credentials credentials; public boolean authenticate() { log.info(quot;authenticating {0}quot;, credentials.getUsername()); //write your authentication logic here, //return true if the authentication was //successful, false otherwise if (quot;adminquot;.equals(credentials.getUsername())) { identity.addRole(quot;adminquot;); return true; } return false; } }
  • 8.
  • 9.
  • 10. /build.properties jboss.home = /home/dallen/opt/jboss-as jboss.domain = default glassfish.home = /home/dallen/opt/glassfish-v2 glassfish.domain = domain1 Tells script which GlassFish installation to target.
  • 11. Adding GlassFish targets Define in separate Ant build file – glassfish.build.xml Prefix targets to avoid naming conflict – prefix: “gf-” Import into build.xml (before first target) <import file=quot;${basedir}/glassfish.build.xmlquot;/>
  • 12. asadmin macro <macrodef name=quot;asadminquot;> <attribute name=quot;cmdquot;/> <attribute name=quot;argsquot; default=quot;quot;/> <attribute name=quot;logquot; default=quot;truequot;/> <element name=quot;pre-conditionsquot; optional=quot;truequot;/> <sequential> <fail unless=quot;glassfish.homequot;>glassfish.home not set</fail> <pre-conditions/> <exec executable=quot;${glassfish.home}/bin/asadminquot;> <arg value=quot;@{cmd}quot;/> <arg line=quot;@{args}quot;/> <redirector outputproperty=quot;gf.cmd.outputquot; alwayslog=quot;@{log}quot;/> </exec> </sequential> </macrodef>
  • 13. Using the asadmin macro Starting the server <asadmin cmd=quot;start-domainquot; args=quot;${glassfish.domain}quot;> <pre-conditions> <fail unless=quot;glassfish.domainquot;>glassfish.domain not set</fail> </pre-conditions> </asadmin> Stopping the server <asadmin cmd=quot;stop-domainquot; args=quot;${glassfish.domain}quot;> <pre-conditions> <fail unless=quot;glassfish.domainquot;>glassfish.domain not set</fail> </pre-conditions> </asadmin> Registering a data source <asadmin cmd=quot;add-resourcesquot; args=quot;${basedir}/resources/glassfish-resources-${profile}.xmlquot;/>
  • 14. <target name=quot;gf-deploy-hibernatequot; description=quot;Deploys Hibernate to be a JPA provider on GlassFishquot;> <fail unless=quot;glassfish.homequot;>glassfish.home not set</fail> <fail unless=quot;glassfish.domainquot;>glassfish.domain not set</fail> <copy todir=quot;${glassfish.home}/domains/${glassfish.domain}/lib/extquot;> <fileset dir=quot;${basedir}/libquot;> <include name=quot;antlr.jarquot;/> <include name=quot;asm.jarquot;/> <include name=quot;asm-attrs.jarquot;/> <include name=quot;cglib.jarquot;/> <include name=quot;commons-collections.jarquot;/> <include name=quot;commons-logging.jarquot;/> <include name=quot;concurrent.jarquot;/> <include name=quot;dom4j.jarquot;/> <include name=quot;hibernate.jarquot;/> <include name=quot;hibernate-*.jarquot;/> <exclude name=quot;hibernate-search.jarquot;/> <include name=quot;javassist.jarquot;/> <include name=quot;jboss-common-core.jarquot;/> <include name=quot;jta.jarquot;/> <include name=quot;persistence-api.jarquot;/> <include name=quot;mysql-connector-java-5.1.6.jarquot;/> </fileset> </copy> </target>
  • 15. /resources/META-INF/persistence-dev.xml <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <persistence> <persistence-unit name=quot;vehicleseequot;> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>vehicleseeDatasource</jta-data-source> <properties> ... <property name=quot;hibernate.transaction.manager_lookup_classquot; value=quot;@transactionManagerLookupClass@quot; /> </properties> </persistence-unit> </persistence> Strip proprietary JNDI prefix java:/ /resources/vehiclesee-dev-ds.xml <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <datasources> <local-tx-datasource> <jndi-name>vehicleseeDatasource</jndi-name> <use-java-context>false</use-java-context> <connection-url>jdbc:mysql://localhost/vehicles</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>dallen</user-name> <password>dallen</password> </local-tx-datasource> </datasources>
  • 16. /resources/glassfish-resources-dev.xml <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <resources> <jdbc-connection-pool name=quot;vehicleseePoolquot; datasource-classname=quot;com.mysql.jdbc.jdbc2.optional.MysqlDataSourcequot; res-type=quot;javax.sql.DataSourcequot;> <property name=quot;userquot; value=quot;dallenquot;/> <property name=quot;passwordquot; value=quot;dallenquot;/> <property name=quot;urlquot; value=quot;jdbc:mysql://localhost/vehiclesquot;/> </jdbc-connection-pool> <jdbc-resource Uses DataSource rather jndi-name=quot;vehicleseeDatasourcequot; than JDBC driver pool-name=quot;vehicleseePoolquot; enabled=quot;truequot; object-type=quot;userquot;/> </resources> JNDI name referenced GlassFish Admin Console in persistence.xml
  • 17. /build.xml (top of jar target) <!-- defaults, can be overridden in preceding target or from commandline flag --> <property name=quot;ejbJndiPatternquot; value=quot;${project.name}/#{ejbName}/localquot;/> <property name=quot;transactionManagerLookupClassquot; value=quot;org.hibernate.transaction.SunONETransactionManagerLookupquot;/> Token replacements for components.properties <filterset id=quot;seamquot;> <filter token=quot;ejbJndiPatternquot; value=quot;${ejbJndiPattern}quot;/> <filter token=quot;seamBootstrapPuquot; value=quot;${seamBootstrapPu}quot;/> <filter token=quot;seamEmfquot; value=quot;${seamEmf}quot;/> <filter token=quot;puJndiNamequot; value=quot;${puJndiName}quot;/> </filterset> Token replacements for persistence.xml <filterset id=quot;persistencequot;> <filter token=quot;transactionManagerLookupClassquot; value=quot;${transactionManagerLookupClass}quot;/> </filterset>
  • 18. /build.xml (jar target) <copy tofile=quot;${jar.dir}/META-INF/persistence.xmlquot; file=quot;${basedir}/resources/META-INF/persistence-${profile}.xmlquot; overwrite=quot;truequot;> <filterset refid=quot;persistencequot;/> </copy> Apply token replacements /build.xml (war target) <copy tofile=quot;${war.dir}/WEB-INF/classes/components.propertiesquot; file=quot;${basedir}/resources/components-${profile}.propertiesquot; overwrite=quot;truequot;> <filterset refid=quot;seamquot;/> </copy>
  • 19. /resources/WEB-INF/components.xml <components xmlns=quot;http://jboss.com/products/seam/componentsquot; ... xmlns:persistence=quot;http://jboss.com/products/seam/persistencequot; xsi:schemaLocation=quot; ... http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsdquot;> <persistence:entity-manager-factory name=quot;entityManagerFactoryquot; persistence-unit-name=quot;vehicleseequot;/> <persistence:managed-persistence-context name=quot;entityManagerquot; entity-manager-factory=quot;#{entityManagerFactory}quot; auto-create=quot;truequot;/> </components> Seam bootstraps persistence unit == application-managed persistence
  • 20. /resources/WEB-INF/components.xml <components xmlns=quot;http://jboss.com/products/seam/componentsquot; ... xmlns:tx=quot;http://jboss.com/products/seam/transactionquot; xsi:schemaLocation=quot; ... http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsdquot;> <tx:ejb-transaction/> </components> Allows Seam to pass along transaction synchronization events to other Seam components. Before completion: - org.jboss.seam.beforeTransactionCompletion After successful completion: - org.jboss.seam.afterTransactionCompletion(true) After transaction failure: - org.jboss.seam.afterTransactionCompletion(false)
  • 21. /build.xml <copy tofile=quot;${war.dir}/WEB-INF/classes/components.propertiesquot; file=quot;${basedir}/resources/components-${profile}.propertiesquot;> <filterset refid=quot;seamquot;/> </copy> + /resources/components-dev.properties jndiPattern=@ejbJndiPattern@ /WEB-INF/classes/components.properties jndiPattern=java:comp/env/vehiclesee/#{ejbName}/local /WEB-INF/components.xml <components> <core:init jndiPattern=quot;@jndiPattern@quot;/> </compoennts>
  • 22. /resources/WEB-INF/web.xml (end of file) <ejb-local-ref> <ejb-ref-name>vehiclesee/EjbSynchronizations/local</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local-home/> <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local> </ejb-local-ref> <ejb-local-ref> <ejb-ref-name>vehiclesee/AuthenticatorBean/local</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local-home/> <local>org.example.vehicles.action.Authenticator</local> </ejb-local-ref> <ejb-local-ref> <ejb-ref-name>vehiclesee/VehicleTradeBean/local</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local-home/> <local>org.example.vehicles.action.VehicleTrade</local> </ejb-local-ref>
  • 23. /build.xml (war target) <target name=quot;warquot; ...> ... <fileset dir=quot;${basedir}/viewquot;> <include name=quot;**/*.xcssquot;/> </fileset> <fileset dir=quot;${basedir}/resourcesquot;> Add fileset to copy the provided theme <include name=quot;**/*.xcssquot;/> resource (theme.xcss) to the classpath </fileset> ... to workaround bug in RichFaces with </target> GlassFish.
  • 24.
  • 25.
  • 26.
  • 27. Achieving hot deploy jboss-seam.jar must be exploded since it contains an EJB – Deploy exploded EAR from staging area – gf-explode uses “adadmin deploydir” Run staging target – gf-hotdeploy runs “ant stage” Seam's hot deploy classloader works! – The catch: only works with a WAR, not an EAR
  • 28. Container-managed persistence Persistence unit must be deployed in a separate JAR JAR must be in EAR lib directory and cannot be exploded Requires additional configuration in components.xml, persistence.xml, and web.xml Allows you to use @PersistenceContext
  • 29. Commands to develop by gf-start - Starts GlassFish gf-stop - Stops GlassFish gf-restart - Restarts GlassFish gf-datasource - Registers the datasource and connection pool for the profile gf-explode - Deploys the exploded archive to GlassFish (initial) gf-hotdeploy - Hot deploys Java classes and components (exploded only) gf-deploy - Deploys the packaged archive to GlassFish gf-undeploy - Undeploys the exploded or packaged archive from GlassFish gf-deploy-hibernate - Deploys Hibernate as a JPA provider to GlassFish