Package net.helipilot50.stocktrade.framework

Examples of net.helipilot50.stocktrade.framework.UsageException


        try {
            ObjectName objectName  = SystemAgent.getStrategy().getObjectName(this, name);
            this.setObjectName(objectName);

        } catch (MalformedObjectNameException e) {
            UsageException errorVar = new UsageException("Cannot create LoadBalanceRouterAgent " + name, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
        } catch (NullPointerException e) {
            UsageException errorVar = new UsageException("Cannot create LoadBalanceRouterAgent " + name, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
        }
        this.setState(Constants.SM_ONLINE);
View Full Code Here


            ObjectName objectName  = SystemAgent.getStrategy().getObjectName(this, "TaskMgrAgent");
            this.setObjectName(objectName);

        } catch (MalformedObjectNameException e) {
            UsageException errorVar = new UsageException("Cannot create TaskMgrAgent", e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
        } catch (NullPointerException e) {
            UsageException errorVar = new UsageException("Cannot create TaskMgrAgent", e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
        }
        this.setState(Constants.SM_ONLINE);
View Full Code Here

     * @param bean
     * @throws UsageException if the passed bean is null
     */
    public void setBean(Object bean) {
      if (bean == null) {
        throw new UsageException("bean should not be null");
      }
      else {
            this.bean = bean;
            if (bean.getClass().equals(beanWrapper.getWrappedClass())) {
              // No need to clear the column names, they're the same as the existing
View Full Code Here

     * {@link #setResultSetHelper(ResultSetHelper)} or a previous call to {@link #mapRow(ResultSet)} or {@link #mapRow(ResultSet, int)}
     * @return
     */
    public Object mapRow() {
      if (this.helper == null) {
        throw new UsageException("no valid ResultSetHelper has been defined.");
      }
      try {
      return this.mapRow(null, 1);
    }
    catch (SQLException e) {
View Full Code Here

    * {@link #setResultSetHelper(ResultSetHelper)} or a previous call to {@link #mapRow(ResultSet)} or {@link #mapRow(ResultSet, int)}
    * @return
    */
    public Object mapRow(int count) {
      if (this.helper == null) {
        throw new UsageException("no valid ResultSetHelper has been defined.");
      }
      try {
        return this.mapRow(null, count);
      }
      catch (SQLException e) {
View Full Code Here

                }
            }
        }
        catch (Exception e) { 
        }
        UsageException errorVar = new UsageException("Column " + pColumn + " does not exist in ResultSet");
        ErrorMgr.addError(errorVar);
        throw errorVar;
    }
View Full Code Here

            stack.push(new TransactionData(TransactionType.INDEPENDENT));
        }
        else if (type == TransactionType.INDEPENDENT) {
            // We're trying to create an independent transaction in a thread that is already participating
            // in a transaction. This is illegal in Forte, so raise an exception
            UsageException ue = new UsageException("An INDEPENDENT transaction may not be nested");
            ue.reasonCode = Constants.SP_ER_INVALIDSTATE;
            throw ue;
        }
        else {
            // We need to add a new item to the stack. If the outer transaction has been started, we just
            // inherit it's data source. Otherwise, we defer the commencement of the transaction until
            // we actually use the data source
            TransactionData lastItem = stack.peek();
            if (lastItem.getType() == TransactionType.NESTED && type == TransactionType.DEPENDENT) {
                // We're trying to create an dependent transaction in a thread that is already participating
                // in a nested transaction. This is illegal in Forte, so raise an exception
                UsageException ue = new UsageException("A DEPENDENT transaction may not be started from a NESTED transaction");
                ue.reasonCode = Constants.SP_ER_INVALIDSTATE;
                throw ue;
            }
            else if (lastItem.getType() == TransactionType.DEPENDENT && type == TransactionType.NESTED) {
                // We're trying to create a nested transaction in a thread that is already participating
                // in a dependent transaction. This is illegal in Forte, so raise an exception
                UsageException ue = new UsageException("A NESTED transaction may not be started from a DEPENDENT transaction");
                ue.reasonCode = Constants.SP_ER_INVALIDSTATE;
                throw ue;
            }
            TransactionData data;
            if (lastItem.dataSource != null) {
View Full Code Here

     * returns the transaction ID for the current transaction
     */
    public static int getTransactionID() {
        LightweightStack<TransactionData> currentTransactions = _transactionStorage.get();
        if (currentTransactions.empty()) {
            throw new UsageException("getTransactionID called when not in a transaction");
        }
        TransactionData transactionData = (TransactionData)currentTransactions.peek();
        return transactionData.id;

    }
View Full Code Here

        // Check to see if the task has been cancelled
        Task.checkTaskCancelled();

        LightweightStack<TransactionData> currentTransactions = _transactionStorage.get();
        if (currentTransactions.empty()) {
            throw new UsageException("rollback called when not in a transaction");
        }
        TransactionData transactionData = (TransactionData)currentTransactions.pop();
        // NESTED transactions get whether to commit or rollback from their outermost transaction
        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
View Full Code Here

        // Check to see if the task has been cancelled
        Task.checkTaskCancelled();

        LightweightStack<TransactionData> currentTransactions = _transactionStorage.get();
        if (currentTransactions.empty()) {
            throw new UsageException("commit called when not in a transaction");
        }
        TransactionData transactionData = (TransactionData)currentTransactions.pop();
        // NESTED transactions get whether to commit or rollback from their outermost transaction
        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.framework.UsageException

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.