public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec spec)
      throws ResourceException {
    log.debug("endpointActivation, spec=" + spec);
    QuartzActivationSpec quartzSpec = (QuartzActivationSpec) spec;

    // allocate instance of endpoint to figure out its endpoint interface
    Class clazz = QuartzJob.class;
    MessageEndpoint tmpMe = endpointFactory.createEndpoint(null);
    if (tmpMe instanceof StatefulJob) clazz = StatefulQuartzJob.class;
    tmpMe.release();

    try {
      JobDetail jobDetail =
          new JobDetail(
              quartzSpec.getJobName(), quartzSpec.getJobGroup(), clazz, true, false, false);
      jobDetail.getJobDataMap().setAllowsTransientData(true);
      jobDetail.getJobDataMap().put("endpointFactory", endpointFactory);
      log.debug("adding job: " + quartzSpec);
      CronTrigger trigger =
          new CronTrigger(
              quartzSpec.getTriggerName(),
              quartzSpec.getTriggerGroup(),
              quartzSpec.getCronTrigger());
      sched.scheduleJob(jobDetail, trigger);
    } catch (Exception e) {
      log.error(e);
      throw new ResourceException(e);
    }
  }
    public void endpointActivation(
        MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec)
        throws ResourceException {
      assertNotNull("messageEndpointFactory is null", messageEndpointFactory);
      assertNotNull("activationSpec is null", activationSpec);
      assertTrue(
          "activationSpec should be an instance of FakeActivationSpec",
          activationSpec instanceof FakeActivationSpec);

      MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
      assertNotNull("endpoint is null", endpoint);
      assertTrue(
          "endpoint should be an instance of FakeMessageListener",
          endpoint instanceof FakeMessageListener);
    }