public List bind(Reader csvStream) { AssertArgument.isNotNull(csvStream, "csvStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(csvStream), javaResult); return (List) javaResult.getBean(beanId); }
public List bind(Reader csvStream) { AssertArgument.isNotNull(csvStream, "csvStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(csvStream), javaResult); return (List) javaResult.getBean(beanId); }
public List bind(Reader fixedLengthStream) { AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(fixedLengthStream), javaResult); return (List) javaResult.getBean(beanId); }
public Map bind(Reader fixedLengthStream) { AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(fixedLengthStream), javaResult); return (Map) javaResult.getBean(beanId); }
public Map bind(Reader csvStream) { AssertArgument.isNotNull(csvStream, "csvStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(csvStream), javaResult); return (Map) javaResult.getBean(beanId); }
public Map bind(Reader fixedLengthStream) { AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(fixedLengthStream), javaResult); return (Map) javaResult.getBean(beanId); }
public Map bind(Reader fixedLengthStream) { AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(fixedLengthStream), javaResult); return (Map) javaResult.getBean(beanId); }
public List bind(Reader fixedLengthStream) { AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(fixedLengthStream), javaResult); return (List) javaResult.getBean(beanId); }
public Map bind(Reader csvStream) { AssertArgument.isNotNull(csvStream, "csvStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(csvStream), javaResult); return (Map) javaResult.getBean(beanId); }
public List bind(Reader fixedLengthStream) { AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream"); JavaResult javaResult = new JavaResult(); smooks.filterSource(new StreamSource(fixedLengthStream), javaResult); return (List) javaResult.getBean(beanId); }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(true); break; case NORESULT: break; default: result = null; break; } return result; } }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(true); break; case NORESULT: break; default: result = null; break; } return result; } }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(); break; case NORESULT: break; default: result = null; break; } return result; } }
public Result createResult( final ResultType type ) { Result result = null; switch ( type ) { case STRING: result = new StringResult(); break; case BYTES: result = new ByteResult(); break; case JAVA: result = new JavaResult(true); break; case NORESULT: break; default: result = null; break; } return result; } }
public <T> Model<T> readModel(Reader message, Class<T> modelRoot) throws SAXException, IOException { AssertArgument.isNotNull(message, "message"); AssertArgument.isNotNull(modelRoot, "modelRoot"); JavaResult result = new JavaResult(); ExecutionContext executionContext = descriptor.getSmooks().createExecutionContext(); Map<Class<?>, Map<String, BeanWriter>> beanWriters = descriptor.getBeanWriters(); BeanTracker beanTracker = new BeanTracker(beanWriters); if(reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } executionContext.getBeanContext().addObserver(beanTracker); if(validate && descriptor.getSchema() != null) { // Validate the message against the schemas... Document messageDoc = toDocument(message); // Validate the document and then filter it through smooks... descriptor.getSchema().newValidator().validate(new DOMSource(messageDoc)); descriptor.getSmooks().filterSource(executionContext, new DOMSource(messageDoc), result); } else { descriptor.getSmooks().filterSource(executionContext, new StreamSource(message), result); } Model<T> model; if(modelRoot == JavaResult.class) { model = new Model<T>(modelRoot.cast(result), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } else { model = new Model<T>(modelRoot.cast(result.getBean(modelRoot)), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } return model; }
public <T> Model<T> readModel(Reader message, Class<T> modelRoot) throws SAXException, IOException { AssertArgument.isNotNull(message, "message"); AssertArgument.isNotNull(modelRoot, "modelRoot"); JavaResult result = new JavaResult(); ExecutionContext executionContext = descriptor.getSmooks().createExecutionContext(); Map<Class<?>, Map<String, BeanWriter>> beanWriters = descriptor.getBeanWriters(); BeanTracker beanTracker = new BeanTracker(beanWriters); if(reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } executionContext.getBeanContext().addObserver(beanTracker); if(validate && descriptor.getSchema() != null) { // Validate the message against the schemas... Document messageDoc = toDocument(message); // Validate the document and then filter it through smooks... descriptor.getSchema().newValidator().validate(new DOMSource(messageDoc)); descriptor.getSmooks().filterSource(executionContext, new DOMSource(messageDoc), result); } else { descriptor.getSmooks().filterSource(executionContext, new StreamSource(message), result); } Model<T> model; if(modelRoot == JavaResult.class) { model = new Model<T>(modelRoot.cast(result), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } else { model = new Model<T>(modelRoot.cast(result.getBean(modelRoot)), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } return model; }
public <T> Model<T> readModel(Reader message, Class<T> modelRoot) throws SAXException, IOException { AssertArgument.isNotNull(message, "message"); AssertArgument.isNotNull(modelRoot, "modelRoot"); JavaResult result = new JavaResult(); ExecutionContext executionContext = descriptor.getSmooks().createExecutionContext(); Map<Class<?>, Map<String, BeanWriter>> beanWriters = descriptor.getBeanWriters(); BeanTracker beanTracker = new BeanTracker(beanWriters); if(reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } executionContext.getBeanContext().addObserver(beanTracker); if(validate && descriptor.getSchema() != null) { // Validate the message against the schemas... Document messageDoc = toDocument(message); // Validate the document and then filter it through smooks... descriptor.getSchema().newValidator().validate(new DOMSource(messageDoc)); descriptor.getSmooks().filterSource(executionContext, new DOMSource(messageDoc), result); } else { descriptor.getSmooks().filterSource(executionContext, new StreamSource(message), result); } Model<T> model; if(modelRoot == JavaResult.class) { model = new Model<T>(modelRoot.cast(result), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } else { model = new Model<T>(modelRoot.cast(result.getBean(modelRoot)), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } return model; }
/** * Bind the input source to the specified type. * <p/> * In order to make a cleaner API, implementing classes should create a more * appropriately named method based on the target binding format, that just * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)} * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}. * * @param inputSource The input source. * @param toType The target type. * @return The target binding type instance. * @throws IOException Error binding source to target type. */ protected <T> T bind(Source inputSource, Class<T> toType) throws IOException { AssertArgument.isNotNull(inputSource, "inputSource"); AssertArgument.isNotNull(toType, "toType"); assertInitialized(); JavaResult javaResult = new JavaResult(); ExecutionContext executionContext = smooks.createExecutionContext(); if (reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } smooks.filterSource(executionContext, inputSource, javaResult); return javaResult.getBean(toType); }
/** * Bind the input source to the specified type. * <p/> * In order to make a cleaner API, implementing classes should create a more * appropriately named method based on the target binding format, that just * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)} * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}. * * @param inputSource The input source. * @param toType The target type. * @return The target binding type instance. * @throws IOException Error binding source to target type. */ protected <T> T bind(Source inputSource, Class<T> toType) throws IOException { AssertArgument.isNotNull(inputSource, "inputSource"); AssertArgument.isNotNull(toType, "toType"); assertInitialized(); JavaResult javaResult = new JavaResult(); ExecutionContext executionContext = smooks.createExecutionContext(); if (reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } smooks.filterSource(executionContext, inputSource, javaResult); return javaResult.getBean(toType); }
/** * Bind the input source to the specified type. * <p/> * In order to make a cleaner API, implementing classes should create a more * appropriately named method based on the target binding format, that just * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)} * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}. * * @param inputSource The input source. * @param toType The target type. * @return The target binding type instance. * @throws IOException Error binding source to target type. */ protected <T> T bind(Source inputSource, Class<T> toType) throws IOException { AssertArgument.isNotNull(inputSource, "inputSource"); AssertArgument.isNotNull(toType, "toType"); assertInitialized(); JavaResult javaResult = new JavaResult(); ExecutionContext executionContext = smooks.createExecutionContext(); if (reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } smooks.filterSource(executionContext, inputSource, javaResult); return javaResult.getBean(toType); }