SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Kürzlich hochgeladen (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

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