Package org.openeai.jms.consumer.commands

Examples of org.openeai.jms.consumer.commands.CommandException


    }
    catch (Exception e) {
      String errMsg = "Exception occurred processing input message in " +
      "org.openeai.jms.consumer.commands.Command.  Exception: " +
      e.getMessage();
      throw new CommandException(errMsg);
    }
   
    // Retrieve text portion of message.
    TextMessage msg = (TextMessage)aMessage;
    try {
      // Clear the message body for the reply, so we do not
      // have to do it later.
      msg.clearBody();
    }
    catch (Exception e) {
      String errMsg = "Error clearing the message body.";
      throw new CommandException(errMsg + ". The exception is: " +
          e.getMessage());
    }
   
    // Get the ControlArea from XML document.
    Element eControlArea = getControlArea(inDoc.getRootElement());
View Full Code Here


    }
    catch (Exception e) {
      String errMsg = "Exception occurred processing input message in " +
        "org.openeai.jms.consumer.commands.Command.  Exception: " +
        e.getMessage();
      throw new CommandException(errMsg);
    }

    // Retrieve text portion of message.
    TextMessage msg = (TextMessage)aMessage;
    try {
      // Clear the message body for the reply, so we do not
      // have to do it later.
      msg.clearBody();
    }
    catch (Exception e) {
      String errMsg = "Error clearing the message body.";
      throw new CommandException(errMsg + ". The exception is: " +
        e.getMessage());
    }

    // Get the ControlArea from XML document.
    Element eControlArea = getControlArea(inDoc.getRootElement());
View Full Code Here

    catch (Exception e) {
      String errMsg = "An exception occurred processing input message in " +
        "org.openeai.jms.consumer.commands.Command.  The exception is: " +
        e.getMessage();
      logger.fatal("[InstitutionalIdentityRequestCommand] " + errMsg);
      throw new CommandException(errMsg);
    }

    // Retrieve text portion of the message.
    TextMessage msg = (TextMessage)aMessage;
    try {
      // Clear the message body for the reply, so we do not
      // have to do it later.
      msg.clearBody();
    }
    catch (Exception e) {
      String errMsg = "Error clearing the message body. The exception is: " +
        e.getMessage();
      logger.fatal("[InstitutionalIdentityRequestCommand] " + errMsg);
      throw new CommandException(errMsg);
    }

    // Get the ControlArea from the XML document.
    Element eControlArea = getControlArea(inDoc.getRootElement());
View Full Code Here

          m_connPool = (EnterpriseConnectionPool)getExecutorAppConfig().getObject(getProperties().getProperty("dbPoolName", "DbPool"));
        }
        catch (Exception e) {
          logger.fatal("Error initializing database connection pool.");
          logger.fatal(e.getMessage(), e);
          throw new CommandException(e.getMessage(), e);
        }
      }
    }

    String queryObjectName = null;
    if (getMessageObject() != null) {
      queryObjectName = getMessageObject().getName();
      logger.info("Query object name is: " + queryObjectName);
    }
    try {
      // build the query object from the contents of the message (QueryFilter)
      XmlEnterpriseObject xeo = (XmlEnterpriseObject)getExecutorAppConfig().getObject(queryObjectName + "." + generateRelease(getMessageRelease()));
       
      xeo.buildObjectFromInput(getMessageObject());

      // query for all jobs that match criteria passed in
      java.util.List listOfJeos = query((LightweightPerson)xeo, getMessageObjectName(), getMessageRelease());
      if (listOfJeos.size() > 0) {
        logger.info("Adding " + listOfJeos.size() + " " +
          getMessageObjectName() + " objects to the Provide-Reply document.");

        // remove DataArea from primed provide reply document.
        replyDoc.getRootElement().
          getChild(DATA_AREA).
          removeChildren(getMessageObjectName());

        // add an Element to the provide document for each XmlEnterpriseObjectImpl stored in the List
        logger.info("Building reply document...");
        for (int j=0; j<listOfJeos.size(); j++) {
          XmlEnterpriseObject x = (XmlEnterpriseObject)listOfJeos.get(j);

          // Put the Element in the reply document...
          Element eOutput = null;
          EnterpriseLayoutManager outElm = x.getOutputLayoutManager("xml");
          x.setOutputLayoutManager(outElm);
          eOutput = (Element)x.buildOutputFromObject();

          replyDoc.getRootElement().
            getChild(DATA_AREA).
            addContent(eOutput);
        }
        logger.info("Reply document built...");
      }
      else {
        logger.info("No rows returned, returning empty reply...");
        replyDoc.getRootElement().
          getChild(DATA_AREA).
          removeChildren(getMessageObjectName());
      }
    }
    catch (Exception e) {
      throw new CommandException(e.getMessage(), e);
    }   
  }
View Full Code Here

      p = m_connPool.getExclusiveConnection();
      conn = p.getConnection();
    }
    catch (Exception e) {
      logger.fatal(e.getMessage(), e);
      throw new CommandException(e.getMessage(), e);
    }

    logger.info("Retrieving " + msgObjectName +
      " information for: " + lPerson.getInstitutionalId());
    try {
      queryStmt = conn.prepareStatement(queryString);
      ResultSet results;
      queryStmt.clearParameters();
      results = queryStmt.executeQuery();
      logger.info("Executed query, building BasicPerson-Provide document...");
      int rowCount = 0;
     
      BasicPerson bp = (BasicPerson)getExecutorAppConfig().getObject(BASICPERSON_NAME);
      EnterpriseLayoutManager outElm = bp.getOutputLayoutManager("xml");
      bp.setOutputLayoutManager(outElm);
     
      // now build the BasicPerson object to return
      while (results.next()) {
        bp.setInstitutionalId(results.getString(1));
        Name name = bp.newName();
        name.setFirstName(results.getString(2));
        name.setMiddleName(results.getString(3));
        name.setLastName(results.getString(4));
        bp.setName(name);
        retrieveAddresses(conn, bp);
        retList.add(bp);
      }
      logger.info("Returning " + retList.size() +
        " BasicPerson records for: " + lPerson.getInstitutionalId());

      queryStmt.close();
      m_connPool.releaseExclusiveConnection(p);
      return retList;
    }
    catch (Exception e) {
      if (queryStmt != null) {
        try {
          queryStmt.close();
        }
        catch (Exception e1) { }
      }
      throw new CommandException(e.getMessage(), e);
    }
    finally {
      try {
        m_connPool.releaseExclusiveConnection(p);
      }
View Full Code Here

        try {
          queryStmt.close();
        }
        catch (Exception e1) { }
      }
      throw new CommandException(e.getMessage(), e);
    }
  }
View Full Code Here

            getObject(getProperties().getProperty("dbPoolName", "DbPool"));
        }
        catch (Exception e) {
          logger.fatal("Error initializing database connection pool.");
          logger.fatal(e.getMessage(), e);
          throw new CommandException(e.getMessage(), e);
        }
      }

      // retrieve Sync Publisher from AppConfig.  This object will be used to publish
      // sync messages when create, delete or update message actions are performed
      // in this authoritative system.
      if (m_producerPool == null) {
        try {
          m_producerPool = (ProducerPool)getExecutorAppConfig().getObject("SyncPublisher");
        }
        catch (Exception e) {
          logger.fatal("Error retrieving 'SyncPublisher' PubSubProducer from AppConfig");
          logger.fatal(e.getMessage(), e);
          throw new CommandException(e.getMessage(), e);
        }
      }
    }

    try {
      // build the message object from the content of the message (DataArea)
      XmlEnterpriseObject xeo = (XmlEnterpriseObject)getExecutorAppConfig().
        getObject(getMessageObjectName() + "." + generateRelease(getMessageRelease()));

      // getMessageObject returns an element (the DataArea in the create-request)
      xeo.buildObjectFromInput(getMessageObject());

      // create the BasicPerson
      try {
        create((BasicPerson)xeo, getMessageObjectName(), getMessageRelease());
      }
      catch (Exception e) {
        String errMessage = "Exception occurred Creating the " + getMessageObjectName() +
          " Java object in the database.  Exception: " + e.getMessage();
        logger.fatal(errMessage);
        throw new CommandException(e.getMessage(), e);
      }

      logger.info("Reply document built...");
      /*
        // remove DataArea from primed provide reply document.
        replyDoc.getRootElement().
          getChild(DATA_AREA).
          removeChildren(getMessageObjectName());

          replyDoc.getRootElement().
            getChild(DATA_AREA).
            addContent(eOutput);
      */
    }
    catch (Exception e) {
      throw new CommandException(e.getMessage(), e);
    }   
  }
View Full Code Here

      conn = p.getConnection();
      conn.setAutoCommit(false);
    }
    catch (Exception e) {
      logger.fatal(e.getMessage(), e);
      throw new CommandException(e.getMessage(), e);
    }

    logger.info("Creating " + msgObjectName +
      " information for: " + bPerson.getInstitutionalId());
    try {

      // spriden
      int pidm = insertSpridenData(conn, bPerson);

      // spbpers
      insertSpbpersData(conn, pidm, bPerson);
     
      // now do the addresses (spraddr)
      for (int i=0; i<bPerson.getAddress().size(); i++) {
        Address addr = bPerson.getAddress(i);
        insertSpraddrData(conn, pidm, bPerson, addr, i+1);
      }

      // now the phones (sprtele)

      // now the email addresses (goremal)

      // publish the sync
      logger.info("Publishing '" + msgObjectName + "-Create-Sync' message for InstitutionalId: " + bPerson.getInstitutionalId());
      PubSubProducer pubSub = (PubSubProducer)m_producerPool.getExclusiveProducer();
      logger.info("Publishing sync with the " + pubSub + " producer named " + pubSub.getProducerName());
      bPerson.createSync(pubSub);
     
      // commit the transaction
      conn.commit();
      logger.info("Committed the transaction.");
      m_producerPool.releaseProducer(pubSub);
      m_connPool.releaseExclusiveConnection(p);
    }
    catch (Exception e) {
      try {
        conn.rollback();
      }
      catch (Exception e1) { }
      throw new CommandException(e.getMessage(), e);
    }
    finally {
      try {
        m_connPool.releaseExclusiveConnection(p);
      }
View Full Code Here

            getObject(getProperties().getProperty("dbPoolName", "DbPool"));
        }
        catch (Exception e) {
          logger.fatal("Error initializing database connection pool.");
          logger.fatal(e.getMessage(), e);
          throw new CommandException(e.getMessage(), e);
        }
      }

      // retrieve Sync Publisher from AppConfig.  This object will be used to publish
      // sync messages when create, delete or update message actions are performed
      // in this authoritative system.
      if (m_producerPool == null) {
        try {
          m_producerPool = (ProducerPool)getExecutorAppConfig().getObject("SyncPublisher");
        }
        catch (Exception e) {
          logger.fatal("Error retrieving 'SyncPublisher' PubSubProducer from AppConfig");
          logger.fatal(e.getMessage(), e);
          throw new CommandException(e.getMessage(), e);
        }
      }
    }

    try {
      // build the message object from the content of the message (DataArea)
      XmlEnterpriseObject xeo = (XmlEnterpriseObject)getExecutorAppConfig().
        getObject(getMessageObjectName() + "." + generateRelease(getMessageRelease()));

      XmlEnterpriseObject baselineXeo = (XmlEnterpriseObject)getExecutorAppConfig().
        getObject(getMessageObjectName() + "." + generateRelease(getMessageRelease()));

      // getMessageObject returns an element (the DataArea in the create-request)
      xeo.buildObjectFromInput(getMessageObject());
      baselineXeo.buildObjectFromInput(getBaseline());

      // create the BasicPerson
      try {
        update((BasicPerson)xeo, (BasicPerson)baselineXeo, getMessageObjectName(), getMessageRelease());
      }
      catch (Exception e) {
        String errMessage = "Exception occurred Creating the " + getMessageObjectName() +
          " Java object in the database.  Exception: " + e.getMessage();
        logger.fatal(errMessage);
        throw new CommandException(e.getMessage(), e);
      }

      logger.info("Reply document built...");
      /*
        // remove DataArea from primed provide reply document.
        replyDoc.getRootElement().
          getChild(DATA_AREA).
          removeChildren(getMessageObjectName());

          replyDoc.getRootElement().
            getChild(DATA_AREA).
            addContent(eOutput);
      */
    }
    catch (Exception e) {
      throw new CommandException(e.getMessage(), e);
    }   
  }
View Full Code Here

      conn = p.getConnection();
      conn.setAutoCommit(false);
    }
    catch (Exception e) {
      logger.fatal(e.getMessage(), e);
      throw new CommandException(e.getMessage(), e);
    }

    logger.info("Updating " + msgObjectName +
      " information for: " + bPerson.getInstitutionalId());
    try {

      conn.setAutoCommit(true);
      int pidm = retrievePidm(conn, bPerson);
      logger.info("PIDM is: " + pidm);
      conn.setAutoCommit(false);
     
      // spriden
      updateSpridenData(conn, pidm, bPerson, bPersonBaseline);

      // spbpers
      updateSpbpersData(conn, pidm, bPerson, bPersonBaseline);
     
      // now do the addresses (spraddr)
      updateSpraddrData(conn, pidm, bPerson, bPersonBaseline);

      // now the phones (sprtele)

      // now the email addresses (goremal)

      // publish the sync
      logger.info("Publishing '" + msgObjectName + "-Update-Sync' message for InstitutionalId: " + bPerson.getInstitutionalId());
      PubSubProducer pubSub = (PubSubProducer)m_producerPool.getExclusiveProducer();
      bPerson.setBaseline(bPersonBaseline);
      bPerson.updateSync(pubSub);
      logger.info("Published sync message");
     
      // commit the transaction
      conn.commit();
      logger.info("Committed the transaction.");
      m_producerPool.releaseProducer(pubSub);
      m_connPool.releaseExclusiveConnection(p);
    }
    catch (Exception e) {
      try {
        conn.rollback();
      }
      catch (Exception e1) { }
      throw new CommandException(e.getMessage(), e);
    }
    finally {
      try {
        m_connPool.releaseExclusiveConnection(p);
      }
View Full Code Here

TOP

Related Classes of org.openeai.jms.consumer.commands.CommandException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.