code: public void enqueuePublishJob(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException {
  
          // check the driver manager
          if ((m_driverManager == null) || (m_dbContextFactory == null)) {
              // the resources are unlocked in the driver manager
              throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_NOT_INITIALIZED_0));
          }
          // prevent new jobs if the engine is disabled
          if (m_shuttingDown || (!isEnabled() && !OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN))) {
              // the resources are unlocked in the driver manager
              throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_DISABLED_0));
          }
  
          // create the publish job
          CmsPublishJobInfoBean publishJob = new CmsPublishJobInfoBean(cms, publishList, report);
          try {
              // enqueue it and
              m_publishQueue.add(publishJob);
              // notify all listeners
              m_listeners.fireEnqueued(new CmsPublishJobBase(publishJob));
          } catch (Throwable t) {
              // we really really need to catch everything here, or else the queue status is broken
              if (m_publishQueue.contains(publishJob)) {
                  m_publishQueue.remove(publishJob);
              }
              // throw the exception again
              throw new CmsException(
                  Messages.get().container(Messages.ERR_PUBLISH_ENGINE_QUEUE_1, publishJob.getPublishHistoryId()),
                  t);
          }
          // try to start the publish job immediately
          checkCurrentPublishJobThread();
      }
docs: Enqueues a new publish job with the given information in publish queue.<p>
  
  All resources should already be locked.<p>
  
  If possible, the publish job starts immediately.<p>
  
  @param cms the cms context to publish for
  @param publishList the resources to publish
  @param report the report to write to
  
  @throws CmsException if something goes wrong while cloning the cms context