You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/03/24 21:52:08 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

craigmcc    01/03/24 12:52:08

  Modified:    catalina build.xml
               catalina/src/share/org/apache/naming/factory
                        ResourceFactory.java
  Added:       catalina/src/share/org/apache/naming/factory
                        MailSessionFactory.java
  Log:
  Add a naming context resource factory for javax.mail.Session resources
  (compliant with J2EE requirements) so that web applications can look up
  and utilize a preconfigured javax.mail.Session instance.  The resource is
  configured by creating <Resource> and <ResourceParams> elements nested in
  the <Context> or <DefaultContext> element in "conf/server.xml" -- the
  example application will be updated to demonstrate this shortly.
  
  NOTE:  the mechanism by which new object factories are registered needs to
  be generalized.
  
  Revision  Changes    Path
  1.34      +2 -0      jakarta-tomcat-4.0/catalina/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/build.xml,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- build.xml	2001/03/23 01:12:11	1.33
  +++ build.xml	2001/03/24 20:52:07	1.34
  @@ -112,6 +112,8 @@
          unless="jdbcse.present" />
         <exclude name="**/factory/TransactionFactory.java" 
          unless="jta.present" />
  +      <exclude name="**/factory/MailSessionFactory.java"
  +       unless="javamail.present" />
         <exclude name="**/factory/SendMailFactory.java"
          unless="javamail.present" />
         <exclude name="**/startup/CatalinaBlock.java" 
  
  
  
  1.4       +13 -3     jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceFactory.java
  
  Index: ResourceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResourceFactory.java	2001/01/23 03:43:54	1.3
  +++ ResourceFactory.java	2001/03/24 20:52:07	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceFactory.java,v 1.3 2001/01/23 03:43:54 remm Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/01/23 03:43:54 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceFactory.java,v 1.4 2001/03/24 20:52:07 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/03/24 20:52:07 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * Object factory for Resources.
    * 
    * @author Remy Maucherat
  - * @version $Revision: 1.3 $ $Date: 2001/01/23 03:43:54 $
  + * @version $Revision: 1.4 $ $Date: 2001/03/24 20:52:07 $
    */
   
   public class ResourceFactory
  @@ -145,6 +145,16 @@
                       try {
                           factory = (ObjectFactory) 
                               Class.forName(javaxSqlDataSourceFactoryClassName)
  +                            .newInstance();
  +                    } catch(Throwable t) {
  +                    }
  +                } else if (ref.getClassName().equals("javax.mail.Session")) {
  +                    String javaxMailSessionFactoryClassName =
  +                        System.getProperty("javax.mail.Session.Factory",
  +                                           "org.apache.naming.factory.MailSessionFactory");
  +                    try {
  +                        factory = (ObjectFactory) 
  +                            Class.forName(javaxMailSessionFactoryClassName)
                               .newInstance();
                       } catch(Throwable t) {
                       }
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/MailSessionFactory.java
  
  Index: MailSessionFactory.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/MailSessionFactory.java,v 1.1 2001/03/24 20:52:07 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/03/24 20:52:07 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.naming.factory;
  
  import java.security.AccessController;
  import java.security.PrivilegedAction;
  import java.util.Enumeration;
  import java.util.Hashtable;
  import java.util.Properties;
  import javax.mail.Session;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.RefAddr;
  import javax.naming.Reference;
  import javax.naming.spi.ObjectFactory;
  
  /**
   * <p>Factory class that creates a JNDI named JavaMail Session factory,
   * which can be used for managing inbound and outbound electronic mail
   * messages via JavaMail APIs.  All messaging environment properties
   * described in the JavaMail Specification may be passed to the Session
   * factory; however the following properties are the most commonly used:</p>
   * <ul>
   * <li>
   * <li><strong>mail.smtp.host</strong> - Hostname for outbound transport
   *     connections.  Defaults to <code>localhost</code> if not specified.</li>
   * </ul>
   *
   * <p>This factory can be configured in a <code>&lt;DefaultContext&gt;</code>
   * or <code>&lt;Context&gt;</code> element in your <code>conf/server.xml</code>
   * configuration file.  An example of factory configuration is:</p>
   * <pre>
   * &lt;Resource name="mail/smtp" auth="CONTAINER"
   *           type="javax.mail.Session"/&gt;
   * &lt;ResourceParams name="mail/smtp"&gt;
   *   &lt;parameter&gt;
   *     &lt;name&gt;factory&lt;/name&gt;
   *     &lt;value&gt;org.apache.naming.factory.MailSessionFactory&lt;/value&gt;
   *   &lt;/parameter&gt;
   *   &lt;parameter&gt;
   *     &lt;name&gt;mail.smtp.host&lt;/name&gt;
   *     &lt;value&gt;mail.mycompany.com&lt;/value&gt;
   *   &lt;/parameter&gt;
   * &lt;/ResourceParams&gt;
   * </pre>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/03/24 20:52:07 $
   */
  
  public class MailSessionFactory implements ObjectFactory {
  
  
      /**
       * The Java type for which this factory knows how to create objects.
       */
      protected static final String factoryType = "javax.mail.Session";
  
  
      /**
       * Create and return an object instance based on the specified
       * characteristics.
       *
       * @param refObj Reference information containing our parameters, or null
       *  if there are no parameters
       * @param name The name of this object, relative to context, or null
       *  if there is no name
       * @param context The context to which name is relative, or null if name
       *  is relative to the default initial context
       * @param env Environment variables, or null if there are none
       *
       * @exception Exception if an error occurs during object creation
       */
      public Object getObjectInstance(Object refObj, Name name, Context context,
  				    Hashtable env) throws Exception 
      {
  
          // Return null if we cannot create an object of the requested type
  	final Reference ref = (Reference) refObj;
          if (!ref.getClassName().equals(factoryType))
              return (null);
  
          // Create a new Session inside a doPrivileged block, so that JavaMail
          // can read its default properties without throwing Security
          // exceptions
          return AccessController.doPrivileged( new PrivilegedAction() {
  		public Object run() {
  
                      // Create the JavaMail properties we will use
                      Properties props = new Properties();
                      props.put("mail.transport.protocol", "smtp");
                      props.put("mail.smtp.host", "localhost");
                      Enumeration attrs = ref.getAll();
                      while (attrs.hasMoreElements()) {
                          RefAddr attr = (RefAddr) attrs.nextElement();
                          if ("factory".equals(attr.getType()))
                              continue;
                          props.put(attr.getType(), (String) attr.getContent());
                      }
  
                      // Create and return the new Session object
                      Session session = Session.getDefaultInstance(props, null);
                      return (session);
  
  		}
  	    } );
  
      }
  
  
  }
  
  
  

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 24 Mar 2001, Glenn Nielsen wrote:

> Craig,
> 
> I have another version of a MailSessionFactory (I thought I had mentioned
> I would take care of it).  It is identical to what you just commited,
> with one exception.
> 

Well, I must have missed your message about taking care of it (but it was
a good learning experience for me anyway).  Once we get the Commons
project up and running, the in-memory naming context stuff might be a good
candidate for a shareable component, and I wanted to understand a bit more
about how it worked first.

> It uses getInstance() instead of getDefaultInstance().  getDefaultInstance()
> creates just one instance of a Session for the entire JVM which would be global
> to all web applications.  With getInstance() you can configure different SMTP settings
> per web application.
> 

That sounds like a *much* better idea.  Go ahead and switch this this to
getInstance() if you want.

> I also have an updated version of the Factory which creates a MimePartDataSource
> which allows more generic configuration of SMTP settings like you did below.
> 

It seems like a pretty good design pattern when the underlying factory
accepts an arbitrary set of properties.

> Regards,
> 
> Glenn
> 

Craig


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Craig,

I have another version of a MailSessionFactory (I thought I had mentioned
I would take care of it).  It is identical to what you just commited,
with one exception.

It uses getInstance() instead of getDefaultInstance().  getDefaultInstance()
creates just one instance of a Session for the entire JVM which would be global
to all web applications.  With getInstance() you can configure different SMTP settings
per web application.

I also have an updated version of the Factory which creates a MimePartDataSource
which allows more generic configuration of SMTP settings like you did below.

Regards,

Glenn

craigmcc@apache.org wrote:
> 
>   /**
>    * <p>Factory class that creates a JNDI named JavaMail Session factory,
>    * which can be used for managing inbound and outbound electronic mail
>    * messages via JavaMail APIs.  All messaging environment properties
>    * described in the JavaMail Specification may be passed to the Session
>    * factory; however the following properties are the most commonly used:</p>
>    * <ul>
>    * <li>
>    * <li><strong>mail.smtp.host</strong> - Hostname for outbound transport
>    *     connections.  Defaults to <code>localhost</code> if not specified.</li>
>    * </ul>
>    *
>    * <p>This factory can be configured in a <code>&lt;DefaultContext&gt;</code>
>    * or <code>&lt;Context&gt;</code> element in your <code>conf/server.xml</code>
>    * configuration file.  An example of factory configuration is:</p>
>    * <pre>
>    * &lt;Resource name="mail/smtp" auth="CONTAINER"
>    *           type="javax.mail.Session"/&gt;
>    * &lt;ResourceParams name="mail/smtp"&gt;
>    *   &lt;parameter&gt;
>    *     &lt;name&gt;factory&lt;/name&gt;
>    *     &lt;value&gt;org.apache.naming.factory.MailSessionFactory&lt;/value&gt;
>    *   &lt;/parameter&gt;
>    *   &lt;parameter&gt;
>    *     &lt;name&gt;mail.smtp.host&lt;/name&gt;
>    *     &lt;value&gt;mail.mycompany.com&lt;/value&gt;
>    *   &lt;/parameter&gt;
>    * &lt;/ResourceParams&gt;
>    * </pre>
>    *
>    * @author Craig R. McClanahan
>    * @version $Revision: 1.1 $ $Date: 2001/03/24 20:52:07 $
>    */
> 
>   public class MailSessionFactory implements ObjectFactory {
> 
> 
>       /**
>        * The Java type for which this factory knows how to create objects.
>        */
>       protected static final String factoryType = "javax.mail.Session";
> 
> 
>       /**
>        * Create and return an object instance based on the specified
>        * characteristics.
>        *
>        * @param refObj Reference information containing our parameters, or null
>        *  if there are no parameters
>        * @param name The name of this object, relative to context, or null
>        *  if there is no name
>        * @param context The context to which name is relative, or null if name
>        *  is relative to the default initial context
>        * @param env Environment variables, or null if there are none
>        *
>        * @exception Exception if an error occurs during object creation
>        */
>       public Object getObjectInstance(Object refObj, Name name, Context context,
>                                     Hashtable env) throws Exception
>       {
> 
>           // Return null if we cannot create an object of the requested type
>         final Reference ref = (Reference) refObj;
>           if (!ref.getClassName().equals(factoryType))
>               return (null);
> 
>           // Create a new Session inside a doPrivileged block, so that JavaMail
>           // can read its default properties without throwing Security
>           // exceptions
>           return AccessController.doPrivileged( new PrivilegedAction() {
>                 public Object run() {
> 
>                       // Create the JavaMail properties we will use
>                       Properties props = new Properties();
>                       props.put("mail.transport.protocol", "smtp");
>                       props.put("mail.smtp.host", "localhost");
>                       Enumeration attrs = ref.getAll();
>                       while (attrs.hasMoreElements()) {
>                           RefAddr attr = (RefAddr) attrs.nextElement();
>                           if ("factory".equals(attr.getType()))
>                               continue;
>                           props.put(attr.getType(), (String) attr.getContent());
>                       }
> 
>                       // Create and return the new Session object
>                       Session session = Session.getDefaultInstance(props, null);
>                       return (session);
> 
>                 }
>             } );
> 
>       }
> 
> 
>   }
> 
> 
> 


----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by Remy Maucherat <re...@apache.org>.
> On Sat, 24 Mar 2001, Remy Maucherat wrote:
>
> > > Where?  This didn't work until I modified ResourceFactory to take care
of
> > > it, copying the way that the default resource factory for a DataSource
is
> > > set up.
> >
> > You can set parameters for a resource (ejb-ref, resource-ref, and the
> > others) with :
> >
> > If the resource is jdbc/TestDB, the parameters are defined with :
> > <ResourceParams name="jdbc/TestDB">
> >
> >
<parameter><name>factory</name><value>factory_class_name</value></parameter>
> >  <parameter><name>user</name><value>sa</value></parameter>
> >  <parameter><name>password</name><value></value></parameter>
> >  <parameter><name>driverClassName</name>
> >    <value>org.hsql.jdbcDriver</value></parameter>
> >  <parameter><name>driverName</name>
> >    <value>jdbc:HypersonicSQL:database</value></parameter>
> > </ResourceParams>
> >
>
> Oh, OK.  We should probably write up some simple docs on this.
>
> Because javax.mail.Session is a standard J2EE resource type, I'm going to
> go ahead and leave it defaulting to the factory I just created, so users
> don't have to remember that.

Sure, that's what we should do with the default types.

> I presume that a user-supplied factory would need to be visible to the
> Catalina class loader, right?

Yes. It can be put where the namingfactory.jar is. I don't know if it works
if it's in the webapp.

> > Note the factory parameter.
> >
> > > Also, I noticed one other thing that I'm about to fix.  The entries
for
> > > resources, EJB references, and so on are getting created in the
> > > "java:com" context.  According to the J2EE spec, they are supposed to
be
> > > in the "java:comp/env" context (along with environment entries).  It's
a
> > > real simple patch, to be submitted shortly after I double check that
it
> > > works correctly.
> >
> > Yes, I made a mistake. I can fix it.
>
> See next CVS commit.

Cool.

Remy


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 24 Mar 2001, Remy Maucherat wrote:

> > Where?  This didn't work until I modified ResourceFactory to take care of
> > it, copying the way that the default resource factory for a DataSource is
> > set up.
> 
> You can set parameters for a resource (ejb-ref, resource-ref, and the
> others) with :
> 
> If the resource is jdbc/TestDB, the parameters are defined with :
> <ResourceParams name="jdbc/TestDB">
> 
> <parameter><name>factory</name><value>factory_class_name</value></parameter>
>  <parameter><name>user</name><value>sa</value></parameter>
>  <parameter><name>password</name><value></value></parameter>
>  <parameter><name>driverClassName</name>
>    <value>org.hsql.jdbcDriver</value></parameter>
>  <parameter><name>driverName</name>
>    <value>jdbc:HypersonicSQL:database</value></parameter>
> </ResourceParams>
> 

Oh, OK.  We should probably write up some simple docs on this.

Because javax.mail.Session is a standard J2EE resource type, I'm going to
go ahead and leave it defaulting to the factory I just created, so users
don't have to remember that.

I presume that a user-supplied factory would need to be visible to the
Catalina class loader, right?

> Note the factory parameter.
> 
> > Also, I noticed one other thing that I'm about to fix.  The entries for
> > resources, EJB references, and so on are getting created in the
> > "java:com" context.  According to the J2EE spec, they are supposed to be
> > in the "java:comp/env" context (along with environment entries).  It's a
> > real simple patch, to be submitted shortly after I double check that it
> > works correctly.
> 
> Yes, I made a mistake. I can fix it.
> 

See next CVS commit.

> Remy
> 
> 

Craig



Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by Remy Maucherat <re...@apache.org>.
> Where?  This didn't work until I modified ResourceFactory to take care of
> it, copying the way that the default resource factory for a DataSource is
> set up.

You can set parameters for a resource (ejb-ref, resource-ref, and the
others) with :

If the resource is jdbc/TestDB, the parameters are defined with :
<ResourceParams name="jdbc/TestDB">

<parameter><name>factory</name><value>factory_class_name</value></parameter>
 <parameter><name>user</name><value>sa</value></parameter>
 <parameter><name>password</name><value></value></parameter>
 <parameter><name>driverClassName</name>
   <value>org.hsql.jdbcDriver</value></parameter>
 <parameter><name>driverName</name>
   <value>jdbc:HypersonicSQL:database</value></parameter>
</ResourceParams>

Note the factory parameter.

> Also, I noticed one other thing that I'm about to fix.  The entries for
> resources, EJB references, and so on are getting created in the
> "java:com" context.  According to the J2EE spec, they are supposed to be
> in the "java:comp/env" context (along with environment entries).  It's a
> real simple patch, to be submitted shortly after I double check that it
> works correctly.

Yes, I made a mistake. I can fix it.

Remy


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 24 Mar 2001, Remy Maucherat wrote:

> > craigmcc    01/03/24 12:52:08
> >
> >   Modified:    catalina build.xml
> >                catalina/src/share/org/apache/naming/factory
> >                         ResourceFactory.java
> >   Added:       catalina/src/share/org/apache/naming/factory
> >                         MailSessionFactory.java
> >   Log:
> >   Add a naming context resource factory for javax.mail.Session resources
> >   (compliant with J2EE requirements) so that web applications can look up
> >   and utilize a preconfigured javax.mail.Session instance.  The resource
> is
> >   configured by creating <Resource> and <ResourceParams> elements nested
> in
> >   the <Context> or <DefaultContext> element in "conf/server.xml" -- the
> >   example application will be updated to demonstrate this shortly.
> >
> >   NOTE:  the mechanism by which new object factories are registered needs
> to
> >   be generalized.
> 
> Why ? You just need to specify a factory parameter in the reference
> parameters.
> 

Where?  This didn't work until I modified ResourceFactory to take care of
it, copying the way that the default resource factory for a DataSource is
set up.

Also, I noticed one other thing that I'm about to fix.  The entries for
resources, EJB references, and so on are getting created in the
"java:com" context.  According to the J2EE spec, they are supposed to be
in the "java:comp/env" context (along with environment entries).  It's a
real simple patch, to be submitted shortly after I double check that it
works correctly.

> Remy
> 
> 

Craig



Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory MailSessionFactory.java ResourceFactory.java

Posted by Remy Maucherat <re...@apache.org>.
> craigmcc    01/03/24 12:52:08
>
>   Modified:    catalina build.xml
>                catalina/src/share/org/apache/naming/factory
>                         ResourceFactory.java
>   Added:       catalina/src/share/org/apache/naming/factory
>                         MailSessionFactory.java
>   Log:
>   Add a naming context resource factory for javax.mail.Session resources
>   (compliant with J2EE requirements) so that web applications can look up
>   and utilize a preconfigured javax.mail.Session instance.  The resource
is
>   configured by creating <Resource> and <ResourceParams> elements nested
in
>   the <Context> or <DefaultContext> element in "conf/server.xml" -- the
>   example application will be updated to demonstrate this shortly.
>
>   NOTE:  the mechanism by which new object factories are registered needs
to
>   be generalized.

Why ? You just need to specify a factory parameter in the reference
parameters.

Remy