Examples of Smooks


Examples of org.milyn.Smooks

     * @throws LifecycleResourceException For errors creating the lifecycle resource.
     */
    public static Smooks createSmooksResource(final String config)
        throws SAXException, IOException, LifecycleResourceException
    {
        final Smooks smooks = new Smooks(config) ;
        lifecycleSmooksResource.getLifecycleResource().put(smooks, smooks) ;
       
        return smooks;
    }
View Full Code Here

Examples of org.milyn.Smooks

     * @throws LifecycleResourceException For errors creating the lifecycle resource.
     */
    public static Smooks createSmooksResource(final InputStream is)
        throws SAXException, IOException, LifecycleResourceException
    {
        final Smooks smooks = new Smooks(is) ;
        lifecycleSmooksResource.getLifecycleResource().put(smooks, smooks) ;
       
        return smooks;
    }
View Full Code Here

Examples of org.milyn.Smooks

            {
                LOGGER.warn("Closing smooks resources for identity " + lifecycleIdentity) ;
                final Iterator<Smooks> smooksIter = resource.keySet().iterator() ;
                while(smooksIter.hasNext())
                {
                    final Smooks smooks = smooksIter.next() ;
                    smooksIter.remove() ;
                    try
                    {
                        smooks.close() ;
                    }
                    catch (final Exception ex)
                    {
                        LOGGER.warn("Unexpected exception closing smooks resource", ex) ;
                    }
View Full Code Here

Examples of org.milyn.Smooks

            handleException("Cannot get the input stream from the config key: " +
                    configKey, synCtx);
        }

        try {
            Smooks smooks = new Smooks(in);
            if (log.isTraceOrDebugEnabled()) {
                log.traceOrDebug("Smooks configuration is created from the config key: "
                        + configKey);               
            }
            return smooks;
View Full Code Here

Examples of org.milyn.Smooks

    if (!Strings.isNullOrEmpty(dataLoader.file()[0])) {
      String configFileName = dataLoader.config();

      log.fine("Loading smooks configuration file " + configFileName);
      Smooks smooks = new Smooks(getClass().getResourceAsStream(
          configFileName));
      ExecutionContext executionContext = smooks.createExecutionContext();
      executionContext.getBeanContext().addBean(OFY_HELPER,
          getOfyHelperBean());
      MapDaoRegister<Object> register = MapDaoRegister
          .newInstance(getDAOMap());

      PersistenceUtil.setDAORegister(executionContext, register);

      for (int i = 0; i < dataLoader.file().length; i++) {
        StreamSource streamSource = new StreamSource(this.getClass()
            .getResourceAsStream(dataLoader.file()[i]));
        smooks.filterSource(executionContext, streamSource,
            new Result[] { null });
      }
    } else {
      log.info("Skipping loading smooks configuration "
          + "file as there is no StreamSource " + "file defined");
View Full Code Here

Examples of org.milyn.Smooks

  if (!Strings.isNullOrEmpty(dataLoader.file()[0])) {
      String configFileName = dataLoader.config();

      LOGGER.fine("Loading smooks configuration file " + configFileName);
      Smooks smooks = new Smooks(getClass().getResourceAsStream(
        configFileName));
      ExecutionContext executionContext = smooks.createExecutionContext();
      executionContext.getBeanContext().addBean(OFY_HELPER,
        getOfyHelperBean());
      MapDaoRegister<Object> register = MapDaoRegister
        .newInstance(getDAOMap());

      PersistenceUtil.setDAORegister(executionContext, register);

      for (int i = 0; i < dataLoader.file().length; i++) {
    StreamSource streamSource = new StreamSource(this.getClass()
      .getResourceAsStream(dataLoader.file()[i]));
    smooks.filterSource(executionContext, streamSource,
      new Result[] {null});
      }
  } else {
      LOGGER.info("Skipping loading smooks configuration "
        + "file as there is no StreamSource " + "file defined");
View Full Code Here

Examples of org.milyn.Smooks

public class Nucleotide_Protein_Parser {

   @SuppressWarnings("unchecked")
   public List<Nucleotide_Protein_Element> parseFile(String fileName) throws IOException, SAXException {
      System.out.println("Parsing [" + fileName + "]");
      Smooks smooks = new Smooks("config-samples/ec2-demo/smooks-config.xml");

      FileInputStream inputStream = null;
      try {
         JavaResult result = new JavaResult();
         inputStream = new FileInputStream(fileName.trim());
         smooks.filterSource(new StreamSource(inputStream), result);
         return (List<Nucleotide_Protein_Element>) result.getBean("customerList");
      } finally {
         smooks.close();
         Util.close(inputStream);
      }
   }
View Full Code Here

Examples of org.milyn.Smooks

        Action executeResultHandler = PipelineFactory.newExecuteResultHandler();
       
        KnowledgeRuntimeCommand insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();
        insertStage.setReceiver( executeResultHandler );

        Smooks smooks = new Smooks( getClass().getResourceAsStream( "smooks-config.xml" ) );

        Transformer transformer = PipelineFactory.newSmooksFromSourceTransformer( smooks,
                                                                                  "root" );
        transformer.setReceiver( insertStage );
View Full Code Here

Examples of org.milyn.Smooks

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        KnowledgeRuntimeCommand setGlobalStage = PipelineFactory.newStatefulKnowledgeSessionSetGlobal( "root" );

        Smooks smooks = new Smooks( getClass().getResourceAsStream( "smooks-config.xml" ) );

        Transformer transformer = PipelineFactory.newSmooksFromSourceTransformer( smooks,
                                                                                  "root" );
        transformer.setReceiver( setGlobalStage );
View Full Code Here

Examples of org.milyn.Smooks

       
        KnowledgeRuntimeCommand insertStage = PipelineFactory.newInsertObjectCommand();
        insertStage.setReceiver( batchExecution );

        // Instantiate Smooks with the config...
        Smooks smooks = new Smooks( getClass().getResourceAsStream( "smooks-config.xml" ) );

        Transformer transformer = PipelineFactory.newSmooksFromSourceTransformer( smooks,
                                                                                  "orderItem" );
        transformer.setReceiver( insertStage );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.