Posts

Showing posts from 2013

Self Monitoring Processor Design for a State Machine Implementation

Self Monitoring Processor Design for a FSM

Using the Runnable and Callable interface as well as the Java 6 ThreadPool classes to create a class design that not only executes a task, but can monitor the execution progress periodically Here is how the interface looks like. Note that each processor has an associated ‘State’ and each state has a status - like ex scheduled, started, awaiting_async, success , fail ,timeout etc. This is because the IProcessor class is also used to implement a state machine.I won't be going through this part in more detail here.
public interface IProcessor extends Runnable, Callable { ProcessingStatus getCurrentStatus(); ProcessingState getCurrentState(); ProcessingStatus execute(); Future getTask(); void setScheduledFutureHandle(ScheduledFuture handle); Now we define an Abstract class that does the basic work
public abstract class Processor implements IProcessor, Comparable { @Override //Method which does the actual work public P…

OpenLayers Advanced Clustering and Setting dynamic images for OpenLayer Styles via Ajax

Update: - Read the same at Medium for better readability; Blogger is not technology blogging friendly JSFiddle Source for this Tutorial
Let us start with a simple OpenLayer map In the JSP or the HTML we have
<head> <script src="http://openlayers.org/api/OpenLayers.js"></script> <script type="text/javascript" src="<%=request.getContextPath()%>/js/maplister.js"></script> <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.7.2.min.js"></script> <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script> </head> <body> <div id="map-id" style="height:100%;width=100%"></div> </body> And on document load AUI().ready(function(X) { resize("scMapListerportlet", "#map-id"); var iconpath ="<%=request.getContextPath()%>/images";…