Package org.milyn

Examples of org.milyn.SmooksException


      serviceDelegator.delegateToESBService( createMessage( element ) );
    }
    catch (MessageDeliverException e)
    {
      String errorMsg = "MessageDeliveryException in visitAfter: ";
      throw new SmooksException( errorMsg, e );
    }
  }
View Full Code Here


        ExceptionVisitor.beforeException = null;
        ExceptionVisitor.afterException = null;
    }

    public void test_terminate_before() throws IOException, SAXException {
        ExceptionVisitor.beforeException = new SmooksException("Terminate Exception");
        test_exception("exception-config.xml", true);
        test_exception("exception-config-sax.xml", true);
    }
View Full Code Here

        test_exception("exception-config.xml", true);
        test_exception("exception-config-sax.xml", true);
    }

    public void test_terminate_after() throws IOException, SAXException {
        ExceptionVisitor.afterException = new SmooksException("Terminate Exception");
        test_exception("exception-config.xml", true);
        test_exception("exception-config-sax.xml", true);
    }
View Full Code Here

            return outputStream;
        } else {
            if(resourceIOObj instanceof OutputStream) {
                return (OutputStream) resourceIOObj;
            } else if(resourceIOObj instanceof Writer) {
                throw new SmooksException("An Writer to the '" + resourceName + "' resource is already open.  Cannot open an OutputStream to this resource now!");
            } else {
                throw new RuntimeException("Invalid runtime ExecutionContext state. Value stored under context key '" + resourceKey + "' must be either and OutputStream or Writer.  Is '" + resourceIOObj.getClass().getName() + "'.");
            }
        }
    }
View Full Code Here

        test_exception("exception-config.xml", true);
        test_exception("exception-config-sax.xml", true);
    }

    public void test_no_terminate_before() throws IOException, SAXException {
        ExceptionVisitor.beforeException = new SmooksException("Terminate Exception");
        test_exception("no-exception-config.xml", false);
        test_exception("no-exception-config-sax.xml", false);
    }
View Full Code Here

            return outputStreamWriter;
        } else {
            if(resourceIOObj instanceof Writer) {
                return (Writer) resourceIOObj;
            } else if(resourceIOObj instanceof OutputStream) {
                throw new SmooksException("An OutputStream to the '" + resourceName + "' resource is already open.  Cannot open a Writer to this resource now!");
            } else {
                throw new RuntimeException("Invalid runtime ExecutionContext state. Value stored under context key '" + resourceKey + "' must be either and OutputStream or Writer.  Is '" + resourceIOObj.getClass().getName() + "'.");
            }
        }
    }
View Full Code Here

    }

    private static OutputStream openOutputStream(AbstractOutputStreamResource resource, String resourceName, ExecutionContext executionContext) {
        if( resource == null )
        {
            throw new SmooksException( "OutputResource '" + resourceName + "' not bound to context.  Configure an '" + AbstractOutputStreamResource.class.getName() "' implementation, or change resource ordering." );
        }

        try
        {
            return resource.getOutputStream( executionContext );
        }
        catch ( IOException e )
        {
            throw new SmooksException( "Unable to set outputstream for '" + resource.getResourceName() + "'.", e );
        }
    }
View Full Code Here

        test_exception("no-exception-config.xml", false);
        test_exception("no-exception-config-sax.xml", false);
    }

    public void test_no_terminate_after() throws IOException, SAXException {
        ExceptionVisitor.afterException = new SmooksException("Terminate Exception");
        test_exception("no-exception-config.xml", false);
        test_exception("no-exception-config-sax.xml", false);
    }
View Full Code Here

            Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());

            if(connection != null) {
              TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX  + getName());
              if(transactionManager == null) {
                throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'");
              }
                try {
                    if(!isAutoCommit()) {
                        // If there's no termination error on the context, commit, otherwise rollback...
                        if(executionContext.getTerminationError() == null) {
                          transactionManager.commit();
                        } else {
                          transactionManager.rollback();
                        }
                    }
                } finally {
                    executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
                    connection.close();
                }
            }
        } catch (SQLException e) {
            throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e);
        } finally {
            executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName());
            executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName());
        }
    }
View Full Code Here

        if(connection == null) {
            AbstractDataSource datasource = (AbstractDataSource) executionContext.getAttribute(DS_CONTEXT_KEY_PREFIX + dataSourceName);

            if(datasource == null) {
                throw new SmooksException("DataSource '" + dataSourceName + "' not bound to context.  Configure an '" + AbstractDataSource.class.getName() "' implementation and target it at '#document'.");
            }
            try {
                connection = datasource.getConnection();

                TransactionManager transactionManager = datasource.createTransactionManager(connection);
                transactionManager.begin();

                executionContext.setAttribute(CONNECTION_CONTEXT_KEY_PREFIX + dataSourceName, connection);
                executionContext.setAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + dataSourceName, transactionManager);
            } catch (SQLException e) {
                throw new SmooksException("Unable to open connection to dataSource '" + dataSourceName + "'.", e);
            }

        }

        return connection;
View Full Code Here

TOP

Related Classes of org.milyn.SmooksException

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.