FileDocCategorySizeDatePackage
MailResourceAdapter.javaAPI DocJBoss 4.2.13995Fri Jul 13 21:01:14 BST 2007org.jboss.resource.adapter.mail

MailResourceAdapter

public class MailResourceAdapter extends Object implements javax.resource.spi.ResourceAdapter
author
Scott.Stark@jboss.org
version
$Revision: 57189 $

Fields Summary
private static Logger
log
private javax.resource.spi.BootstrapContext
ctx
private EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap
activations
The activations by activation spec
private org.jboss.resource.adapter.mail.inflow.NewMsgsWorker
newMsgsWorker
Constructors Summary
Methods Summary
public voidendpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec spec)

      log.debug("endpointActivation, spec="+spec);
      MailActivationSpec mailSpec = (MailActivationSpec) spec;
      MailActivation activation = new MailActivation(this, endpointFactory,
         mailSpec);
      try
      {
         newMsgsWorker.watch(activation);
      }
      catch (InterruptedException e)
      {
         throw new ResourceException("Failed to schedule new msg check", e);
      }
      activations.put(spec, activation);
   
public voidendpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec spec)

      log.debug("endpointDeactivation, spec="+spec);
      MailActivation activation = (MailActivation) activations.remove(spec);
      if (activation != null)
         activation.release();
   
public javax.resource.spi.work.WorkManagergetWorkManager()
Get the work manager

return
the work manager


                
     
   
      return ctx.getWorkManager();
   
public javax.transaction.xa.XAResource[]getXAResources(javax.resource.spi.ActivationSpec[] specs)

      return new XAResource[0];
   
public voidstart(javax.resource.spi.BootstrapContext ctx)

      log.debug("start");
      this.ctx = ctx;
      WorkManager mgr = ctx.getWorkManager();
      newMsgsWorker = new NewMsgsWorker(mgr);
      try
      {
         mgr.scheduleWork(newMsgsWorker);
      }
      catch (WorkException e)
      {
         throw new ResourceAdapterInternalException(e);
      }
   
public voidstop()

      log.debug("stop");
      newMsgsWorker.release();