Push Notifications

Image
A notification in a message you can display to the user outside of your application's normal UI. When you tell the system to issue a notification, it first appears as an icon in the  notification area . To see the details of the notification, the user opens the  notification drawer . Both the notification area and the notification drawer are system-controlled areas that the user can view at any time. System will also display the notification as a TOAST when user is logged-in along with increment in the notification drawer. Lightweight Event Driven Notification System 1.1      Event Generation The event generation phase happens while processing the response to a user request. As such, we wanted to ensure that there was little or no impact on the response times from where notification is called/generated. To ensure this was the case, all we will do is store the minimum amount of data possible/lightweight message on the queue. We store the min...

Multi-Files-Parser

Multi-File Parser is having ability to parse XML, JSON, XLS and CSV. It is written on top of various industry standard parsers. The API is simple to use, independent in nature and is written to perform and scale.
  • It is written using Strategy so new strategies i.e. Parsers for new formats can be added adhering Single Responsibility.
  • Ability to read files from a directory or File[].
  • Supports paralellism i.e. processes files in parallel using Java 7 Fork/Join.
  • Easy data validation support using JSR-303 Bean Validation annotations.
  • Uses Notification Pattern (bliki) for validation errors.
  • Spring Support
##Usage Simple usage with a single line of code.
Example XML Parse Example. Check for all examples in [test] (https://github.com/dapinder-dhillon/Multi-Files-Parser/tree/master/src/test) folder 


@Autowired
private DataFeedController dataFeedController;
....
..
Map rtnObj = dataFeedController.process(Records.class, sourceDir, FeedSupportedFileTypes.XML);

if (!CollectionUtils.isEmpty(rtnObj)) {
				final Notification notification = dataFeedController.validate(Records.class, 
                                                     FeedSupportedFileTypes.XML,	rtnObj);
				if (notification.hasErrors()) {
					throw new MyCustomException(notification.errorMessage());
				}
				
				Set keys = rtnObj.keySet();
				for (String key : keys) {
					Records recs = rtnObj.get(key);
					if (!CollectionUtils.isEmpty(recs.getRecords())) {
						for (Record record : recs.getRecords()) {
							//Process Records..
						}
					}
			  }
				
}

POJO Class definition

@XmlRootElement(name = "records")
public class Records {

	private List records;

....
....


....

@XmlRootElement(name = "record")
public class Record {

	@NotNull
	@Size(max = 3)
	@PropertyLabel(value="Origin")
	private String orgn;
	private String dstn;
	private String airtcraftType;
...
.....

Building Multi-File Parser from Source Code Gradle is used to build Multi-File parser.
##License The project is licensed under the terms of the Apache v2 license

Download Source

Comments

Popular posts from this blog

Creating your Cache with LRU Algorithm

Heap Dump Analysis

Understanding OutOfMemory Issues