User: user57  
  Date: 01/07/31 22:11:01

  Modified:    src/main/org/jboss/resource Tag: jboss_buildmagic
                        ConnectionFactoryLoader.java RARDeployer.java
                        RARDeployerMBean.java RARMetaData.java
  Log:
   o updated from HEAD
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.4.1   +75 -8     jbosscx/src/main/org/jboss/resource/ConnectionFactoryLoader.java
  
  Index: ConnectionFactoryLoader.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/ConnectionFactoryLoader.java,v
  retrieving revision 1.4
  retrieving revision 1.4.4.1
  diff -u -r1.4 -r1.4.4.1
  --- ConnectionFactoryLoader.java      2001/06/20 02:46:00     1.4
  +++ ConnectionFactoryLoader.java      2001/08/01 05:11:01     1.4.4.1
  @@ -49,16 +49,26 @@
   import org.jboss.util.ServiceMBeanSupport;
   
   /**
  - *   Service that configures an instance of a deployed resource
  - *   adapter and binds the resulting connection factory into JNDI.
  + * Service that configures an instance of a deployed resource
  + * adapter and binds the resulting connection factory into JNDI.
    *
  - *   <p> This service does nothing until it receives a notification
  - *   from the RAR deployer that the resource adapter has been
  - *   deployed.
  + * <p> This service does nothing until the RAR deployer indicates that
  + * the resource adapter has been deployed.  If the resource adapter is
  + * deployed prior to this service being started then the connection
  + * factory is loaded immediately, otherwise notification from the RAR
  + * deployer is waited for.
    *      
  - *   @see RARDeployer
  - *   @author Toby Allsopp ([EMAIL PROTECTED])
  - *   @version $Revision: 1.4 $
  + * @see RARDeployer
  + * @author <a href="[EMAIL PROTECTED]">Toby Allsopp</a>
  + * @version $Revision: 1.4.4.1 $
  + *
  + * <p><b>Revisions:</b>
  + *
  + * <p><b>20010725 Toby Allsopp (patch from David Jencks)</b>
  + * <ul>
  + *   <li>Support the case of the resource adapter being deployed
  + *       before this service is started
  + * </ul>
    */
   public class ConnectionFactoryLoader
      extends ServiceMBeanSupport
  @@ -165,6 +175,63 @@
                                        new RAFilter(log), null);
   
         log = Log.createLog(factoryName);
  +   }
  +
  +   protected void startService()
  +      throws Exception
  +   {
  +      // If this factory has not already been loaded...
  +      if (!cfs.containsKey(factoryName))
  +      {
  +         // ... and the RAR deployer exists...
  +         if (server.isRegistered(rarDeployerObjectName))
  +         {
  +            Object[] args = new Object[] { resourceAdapterName };
  +            String[] sig = new String[] { "java.lang.String" };
  +            RARMetaData rmd = (RARMetaData) server.invoke(
  +               rarDeployerObjectName, "getMetaData", args, sig);
  +            // ... and the RAR has been deployed...
  +            if (rmd != null)
  +            {
  +               // ... then load the connection factory immediately
  +               // because we have missed notification of the RAR's
  +               // deployment
  +               loadConnectionFactory(rmd);
  +            }
  +         }
  +      }
  +   }
  +
  +   protected void stopService()
  +   {
  +      // If this factory has been loaded...
  +      if (cfs.containsKey(factoryName))
  +      {
  +         try
  +         {
  +            // ... and the RAR deployer exists...
  +            if (server.isRegistered(rarDeployerObjectName))
  +            {
  +               Object[] args = new Object[] { resourceAdapterName };
  +               String[] sig = new String[] { "java.lang.String" };
  +               RARMetaData rmd = (RARMetaData) server.invoke(
  +                  rarDeployerObjectName, "getMetaData", args, sig);
  +               // ... and the RAR has been deployed...
  +               if (rmd != null)
  +               {
  +                  // ... then unload the connection factory
  +                  // immediately because we won't be around to receive
  +                  // notification of the RAR's undeployment
  +                  unloadConnectionFactory(rmd);
  +               }
  +            }
  +         }
  +         catch (Exception e)
  +         {
  +            log.error("Problem stopping ConnectionFactoryLoader service:");
  +            log.exception(e);
  +         }
  +      }
      }
   
      // NotificationListener implementation ---------------------------
  
  
  
  1.3.4.1   +30 -41    jbosscx/src/main/org/jboss/resource/RARDeployer.java
  
  Index: RARDeployer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARDeployer.java,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- RARDeployer.java  2001/05/05 07:12:46     1.3
  +++ RARDeployer.java  2001/08/01 05:11:01     1.3.4.1
  @@ -29,28 +29,32 @@
   
   import javax.management.Notification;
   
  -//import org.jboss.configuration.ConfigurationServiceMBean;
   import org.jboss.deployment.DeployerMBeanSupport;
   import org.jboss.deployment.DeploymentException;
   import org.jboss.logging.Log;
   import org.jboss.metadata.XmlFileLoader;
  -//import org.jboss.util.MBeanProxy;
   
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
   /**
  - *   Service that deploys ".rar" files containing resource
  - *   adapters. Deploying the RAR file is the first step in making the
  - *   resource adapter available to application components; once it is
  - *   deployed, one or more connection factories must be configured and
  - *   bound into JNDI, a task performed by the
  - *   <code>ConnectionFactoryLoader</code> service.
  + * Service that deploys ".rar" files containing resource adapters.
  + * Deploying the RAR file is the first step in making the resource
  + * adapter available to application components; once it is deployed,
  + * one or more connection factories must be configured and bound into
  + * JNDI, a task performed by the <code>ConnectionFactoryLoader</code>
  + * service.
    *
  - *   @author Toby Allsopp ([EMAIL PROTECTED])
  - *   @version $Revision: 1.3 $
  + * @author Toby Allsopp ([EMAIL PROTECTED])
  + * @version $Revision: 1.3.4.1 $
    *
  - *   @see org.jboss.resource.ConnectionFactoryLoader
  + * @see org.jboss.resource.ConnectionFactoryLoader
  + *
  + * <p><b>Revisions:</b>
  + *
  + * <p><b>20010725 Toby Allsopp (patch from David Jencks)</b>
  + * <ul><li>Implemented <code>getMetaData</code> so that connection
  + * factories can be loaded after RAR deployment</li></ul>
    */
   public class RARDeployer
      extends DeployerMBeanSupport
  @@ -90,6 +94,21 @@
   
      public String getName() { return "RARDeployer"; }
   
  +   public RARMetaData getMetaData(String resourceAdapterName)
  +   {
  +      Collection dis = getDeployments().values();
  +      Iterator i = dis.iterator();
  +      while (i.hasNext())
  +      {
  +         DeploymentInfo di = (DeploymentInfo) i.next();
  +         if (di.metadata.getDisplayName().equals(resourceAdapterName))
  +         {
  +            return di.metadata;
  +         }
  +      }
  +      return null;
  +   }
  +
      public void initService() throws Exception
      {
         // find the temp directory - it contains the file
  @@ -245,36 +264,6 @@
            Thread.currentThread().getContextClassLoader());
   
         metadata.setClassLoader(cl);
  -
  -      // Look for a META-INF/ra-jboss.xml file that defines connection
  -      // factories. My current idea is that this can define connection
  -      // factory loaders in exactly the same way as jboss.jcml.
  -
  -      /* not quite implemented yet
  -      File jbossDDFile = new File(unpackedDir, "META-INF/ra-jboss.xml");
  -
  -      if (jbossDDFile.exists())
  -      {
  -         log.log("Loading JBoss deployment descriptor at '" + jbossDDFile +
  -                 "'");
  -         try
  -         {
  -            Document jbossDD = XmlFileLoader.getDocument(jbossDDFile.toURL());
  -            ConfigurationServiceMBean cs = (ConfigurationServiceMBean)
  -               MBeanProxy.create(ConfigurationServiceMBean.class,
  -                                 ConfigurationServiceMBean.OBJECT_NAME);
  -            cs.load(jbossDD);
  -            //FIXME need to get reference to newly created MBean so we
  -            //can (a) call init and start on it and (b) destroy it
  -            //when this RAR is undeployed
  -         }
  -         catch (Exception e)
  -         {
  -            log.warning("Problem occurred while loading '" + jbossDDFile + "'");
  -            log.exception(e);
  -         }
  -      }
  -      */
   
         // Let's tell the waiting hordes (of connection factory loaders)
         // that this resource adapter is available
  
  
  
  1.2.4.1   +12 -5     jbosscx/src/main/org/jboss/resource/RARDeployerMBean.java
  
  Index: RARDeployerMBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARDeployerMBean.java,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- RARDeployerMBean.java     2001/04/15 04:31:39     1.2
  +++ RARDeployerMBean.java     2001/08/01 05:11:01     1.2.4.1
  @@ -9,11 +9,11 @@
   import org.jboss.deployment.DeployerMBean;
   
   /**
  - *   Exposed management interface for the <code>RARDeployer</code>
  - *   service.
  + * Exposed management interface for the <code>RARDeployer</code>
  + * service.
    *
  - *   @author Toby Allsopp ([EMAIL PROTECTED])
  - *   @version $Revision: 1.2 $
  + * @author Toby Allsopp ([EMAIL PROTECTED])
  + * @version $Revision: 1.2.4.1 $
    */
   public interface RARDeployerMBean
      extends DeployerMBean
  @@ -24,5 +24,12 @@
       
      // Public --------------------------------------------------------
   
  -//     public RARMetaData getMetaData(String resourceAdapterName);
  +   /**
  +    * Returns metadata for a deployed resource adapter.
  +    *
  +    * @param resourceAdapterName the name of the resource adapter
  +    * @return the resource adapter's metadata or <code>null</code> if
  +    *         no resource adapter by that name is deployed
  +    */
  +   public RARMetaData getMetaData(String resourceAdapterName);
   }
  
  
  
  1.3.4.1   +9 -9      jbosscx/src/main/org/jboss/resource/RARMetaData.java
  
  Index: RARMetaData.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARMetaData.java,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- RARMetaData.java  2001/04/15 04:31:39     1.3
  +++ RARMetaData.java  2001/08/01 05:11:01     1.3.4.1
  @@ -26,7 +26,7 @@
    *
    *   @see RARDeployer
    *   @author Toby Allsopp ([EMAIL PROTECTED])
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.3.4.1 $
    */
   public class RARMetaData
      //   extends Y
  @@ -278,15 +278,15 @@
      {
         String s = getElementContent(element);
         int ts;
  -      if      (s.equals("no_transaction"   )) ts = TX_SUPPORT_NO;
  -      else if (s.equals("local_transaction")) ts = TX_SUPPORT_LOCAL;
  -      else if (s.equals("xa_transaction"   )) ts = TX_SUPPORT_XA;
  +      if      (s.equals("NoTransaction"   )) ts = TX_SUPPORT_NO;
  +      else if (s.equals("LocalTransaction")) ts = TX_SUPPORT_LOCAL;
  +      else if (s.equals("XATransaction"   )) ts = TX_SUPPORT_XA;
         else
            throw new DeploymentException("Invalid transaction support '" +
                                          s + "', it must be one of " +
  -                                       "'no_transaction', " +
  -                                       "'local_transaction' or " +
  -                                       "'xa_transaction'");
  +                                       "'NoTransaction', " +
  +                                       "'LocalTransaction' or " +
  +                                       "'XATransaction'");
         transactionSupport = ts;
      }
   
  @@ -345,12 +345,12 @@
         log.warning("Loading "+getElementContent(element).trim());
      }
   
  -   private void setAuthMechanism(Element element) throws DeploymentException
  +   private void setAuthenticationMechanism(Element element) throws 
DeploymentException
      {
         invokeChildren(element);
      }
   
  -   private void setAuthMechType(Element element) throws DeploymentException
  +   private void setAuthenticationMechanismType(Element element) throws 
DeploymentException
      {
         authMechType = getElementContent(element);
      }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to