Package org.milyn

Examples of org.milyn.SmooksException


                            try {
                              @SuppressWarnings("unchecked")
                                List<Map<String, Object>> resultSet = (List<Map<String, Object>>) resultSetObj;
                                statementExec.executeJoinedStatement(connection, resultSet);
                            } catch(ClassCastException e) {
                                throw new SmooksException("Cannot execute joined statement '" + statementExec.getStatement() + "' on ResultSet '" + resultSetName + "'.  Must be of type 'List<Map<String, Object>>'.  Is of type '" + resultSetObj.getClass().getName() + "'.");
                            }
                        } else {
                            throw new SmooksException("Cannot execute joined statement '" + statementExec.getStatement() + "' on ResultSet '" + resultSetName + "'.  ResultSet not found in ExecutionContext.");
                        }
                    }
                }
            }
        } catch (SQLException e) {
            throw new SmooksException("Error executing SQL Statement '" + statement + "'.", e);
        }
    }
View Full Code Here


        try {
      // Get a reader for the YAML source...
          Reader yamlStreamReader = yamlInputSource.getCharacterStream();
          if(yamlStreamReader == null) {
              throw new SmooksException("The InputSource doesn't provide a Reader character stream. Make sure that you supply a reader to the Smooks.filterSource method.");
          }
          YamlToSaxHandler yamlToSaxHandler = new YamlToSaxHandler(contentHandler, anchorAttributeName, aliasAttributeName, indent);

          EventHandler eventHandler;
          if(aliasStrategy == AliasStrategy.REFER) {
View Full Code Here

      final ExecutionContext context,
      final Session jmsSession ) throws SmooksException
  {
        final Object bean = BeanRepositoryManager.getBeanRepository(context).getBean( beanId );
        if(bean == null) {
            throw new SmooksException("Bean beandId '" + beanId + "' not available in the bean repository of this execution context.  Check the order in which your resources are being applied (in Smooks configuration).");
        }
        return createTextMessage( bean.toString(), jmsSession );
  }
View Full Code Here

               Element keyMapParamElement = keyMapParam.getXml();

               if(keyMapParamElement != null) {
                   return KeyMapDigester.digest(keyMapParamElement);
               } else {
                 throw new SmooksException("Sorry, the key properties must be available as XML DOM. Please configure using XML.");
               }
           }
       }
       return Collections.emptyMap();
  }
View Full Code Here

    throws SmooksException
  {
        final Object bean = BeanRepositoryManager.getBeanRepository(context).getBean(beanId);

        if(bean == null) {
          throw new SmooksException("Bean beandId '" + beanId + "' not available in the bean repository of this execution context.  Check the order in which your resources are being applied (in Smooks configuration).");
        }

        if(bean instanceof Serializable == false) {
      throw new SmooksException("The bean unde beanId '" + beanId + "' with type " + bean.getClass().getName() + "'  can't be send with an JMS ObjectMessage because it isn't serializable.");
    }

        return createObjectMessage( (Serializable) bean, jmsSession );
  }
View Full Code Here

public class MapMessageCreationStrategy  implements MessageCreationStrategy {

  public Message createJMSMessage(String beanId, ExecutionContext context, Session jmsSession) throws SmooksException {
    final Object bean = BeanRepositoryManager.getBeanRepository(context).getBean( beanId );
        if(bean == null) {
            throw new SmooksException("Bean beandId '" + beanId + "' not available in the bean repository of this execution context.  Check the order in which your resources are being applied (in Smooks configuration).");
        }
        if(bean instanceof Map == false) {
          throw new SmooksException("The bean unde beanId '" + beanId + "' with type " + bean.getClass().getName() + "'  can't be send with an JMS MapMessage because it doesn't implement a Map interface.");
        }

        return createMapMessage( (Map<?, ?>) bean, jmsSession );
  }
View Full Code Here

        try {
          @SuppressWarnings("unchecked")
            List<Map<String, Object>> resultSet = (List<Map<String, Object>>) beanRepository.getBean(resultSetBeanId);

            if(resultSet == null) {
                throw new SmooksException("Resultset '" + resultSetName + "' not found in bean context.  Make sure an appropriate SQLExecutor resource config wraps this selector config.");
            }

            try {
              Object selectedRow = null;

              Iterator<Map<String, Object>> resultIter = resultSet.iterator();
                while (selectedRow == null && resultIter.hasNext()) {
                  Map<String, Object> row = resultIter.next();

                  beanMapClone.put("row", row);

                    if(whereEvaluator.eval(beanMapClone)) {
                      selectedRow = row;
                      beanRepository.addBean(beanIdObj, selectedRow, source);
                    }
                }

                if(selectedRow == null && failedSelectError != null) {
                    throw new DataSelectionException(failedSelectError.apply(beanRepository.getBeanMap()));
                }

                if(logger.isDebugEnabled()) {
                    logger.debug("Selected resultset where '" + whereEvaluator.getExpression() + "': [" + selectedRow + "].");
                }
            } catch(ClassCastException e) {
                throw new SmooksException("Bean '" + resultSetName + "' cannot be used as a Reference Data resultset.  The resultset List must contain entries of type Map<String, Object>.");
            }
        } catch(ClassCastException e) {
            throw new SmooksException("Bean '" + resultSetName + "' cannot be used as a Reference Data resultset.  A resultset must be of type List<Map<String, Object>>. '" + resultSetName + "' is of type '" + beanRepository.getBean(resultSetBeanId).getClass().getName() + "'.");
        }
    }
View Full Code Here

        //  create a new file in the destination directory
        File newFile = new File( workingFile.getParentFile(), newFileName );

        if(newFile.exists()) {
            throw new SmooksException( "Could not rename [" + workingFile.getAbsolutePath() + "] to [" + newFile.getAbsolutePath() + "]. [" + newFile.getAbsolutePath() + "] already exists.");
        }

        //  try to rename the tmp file to the new file
        boolean renameTo = workingFile.renameTo( newFile ) ;
        if ( !renameTo )
        {
            throw new SmooksException( "Could not rename [" + workingFile.getAbsolutePath() + "] to [" + newFile.getAbsolutePath() + "]");
        }
        workingFile.delete();

        return newFile;
    }
View Full Code Here

                FileListAccessor.addFileName( listFile.getAbsolutePath(), executionContext );
                try {
                    writer = new FileWriter( listFile );
                    executionContext.setAttribute(listFileNamePatternCtxKey, writer);
                } catch (IOException e) {
                    throw new SmooksException("", e);
                }
            }

            try
            {
                writer.write( newFile.getAbsolutePath() + LINE_SEPARATOR );
                writer.flush();
            }
            catch (IOException e)
            {
                throw new SmooksException ( "IOException while trying to write to list file [" + getListFileName(executionContext) + "] :", e );
            }
        }
    }
View Full Code Here

    DocumentBuilder docBuilder;
   
    try {
      docBuilder = documentBuilderFactory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
      throw new SmooksException("Unable to parse message and dynamically bind into object model.  DOM Parser confguration exception.", e);
    }
   
    try {
      return docBuilder.parse(new InputSource(message));
    } catch (SAXException e) {
      throw new SmooksException("Unable to parse message and dynamically bind into object model.  Message format exception.", e);
    } catch (IOException e) {
      throw new SmooksException("Unable to parse message and dynamically bind into object model.  IO exception.", e);
    } finally {
      try {
        message.close();
      } catch (IOException e) {
        logger.debug("Exception closing message reader.", e);
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.