Version 3

    Notes on using Seam

    Here are Michael's notes on how he is integrating Seam as the back end. :

    1. modify root pom.xml to have special repo with Seam maven profiles:

        <!-- this is needed for Seam which is not in the jboss repo or the maven one in a useful form -->
        <repository>
            <id>softeu-repo</id>
            <url>http://maven.softeu.cz/</url>
        </repository>
    

    2. modify the drools-jbrms pom to use the appropriate profile depdendency:

       <dependency>
             <groupId>jboss.seam.profiles</groupId>
            <artifactId>seam-nopersistence</artifactId>
            <version>1.2.0.GA</version>
            <scope>compile</scope>
       </dependency>
    

    3. Modify the launch config for the hosted mode - only needs GWT and the jbrms project stuff (no other dependencies)

    NOTE: an external server will need to be started

    Add params to the launch for -noserver -port 8080

    This requires the external service to be started, and then the hosted browser can have same url as normal browser, but for debugging GUI.

    4. Something like the following deployment script is needed:

    mvn package -Dmaven.test.skip=true
    cp ./target/drools-jbrms.war /home/michael/apps/jboss-4.0.5.GA/server/default/deploy
    

    5. modify web.xml to look like :

    <web-app>
      <display-name>Archetype Created Web Application</display-name>
      
        <listener>
            <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
        </listener>  
      
        <filter>
            <filter-name>Seam Filter</filter-name>
            <filter-class>org.jboss.seam.web.ContextFilter</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>Seam Filter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
          
      
         <servlet>
              <servlet-name>JBRMSServiceServlet</servlet-name>
              <servlet-class>org.drools.brms.server.JBRMSServiceServlet</servlet-class>
         </servlet>  
         
         <servlet>
              <servlet-name>FileUploadServlet</servlet-name>
              <servlet-class>org.drools.brms.server.FileUploadServlet</servlet-class>
         </servlet>  
      
         <servlet-mapping>
              <servlet-name>JBRMSServiceServlet</servlet-name>
              <url-pattern>/org.drools.brms.JBRMS/jbrmsService</url-pattern>
         </servlet-mapping>  
         
         <servlet-mapping>
              <servlet-name>FileUploadServlet</servlet-name>
              <url-pattern>/org.drools.brms.JBRMS/fileManager</url-pattern>
         </servlet-mapping>  
         
        <listener>
            <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
        </listener>     
      
    </web-app>
    
    

    6. Add components.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <components xmlns="http://jboss.com/products/seam/components"
                xmlns:core="http://jboss.com/products/seam/core"
                xmlns:security="http://jboss.com/products/seam/security"
                xmlns:web="http://jboss.com/products/seam/web"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation=
                    "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
                     http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
                     http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd
                     http://jboss.com/products/seam/web http://jboss.com/products/seam/web-1.2.xsd">
    
        <core:init debug="true"></core:init>
        
        <!--<security:identity authenticate-method="#{authenticator.authenticate}"></security:identity>               -->
    
        <!--        <component name="org.jboss.seam.theme.themeSelector">
            <property name="availableThemes">
                <value>default</value>
                <value>accessible</value>
                <value>printable</value>
            </property>
            <property name="cookieEnabled">true</property>
        </component>
        -->
         
    
    </components>
    

    7. add seam.properties to src/main/resources (empty is fine - is needed by Seam to bootstrap)

    8. Copy RemoteServiceServlet source from GWT into project, make JBRMS extend it - can insert code into processCall where it gets the interface, and the method, and lookup Seam beans instead.

     

    9. Can then do cool stuff with Seam annotations like:

    @Name("testName")
    @Scope(ScopeType.SESSION)
    public class SeamHelper {
    
        private long stamp = System.currentTimeMillis();
        
        @In
        private SeamAnother another;
        
        @In
        private SeamEvent event;
        
        @WebRemote
        public void log() {
    

    and

    @Name("another")
    @Scope(ScopeType.SESSION)
    @Startup
    public class SeamAnother {
    
        private long l = System.currentTimeMillis();
        public void log() {
            System.out.println("Session timestamp: " + l );
        }
        
    }
    
    
    

    and

    @Name( "event" )
    @Scope(ScopeType.EVENT)
    @AutoCreate
    public class SeamEvent {
        private long l = System.currentTimeMillis();
        public void log() {
            System.out.println("Event timestamp: " + l );
        }
    }