<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
	<template autoinsert="true" context="java" deleted="false" description="Create a new generic ArrayList" enabled="true" name="list">${:import(java.util.List,&#13;
  java.util.ArrayList)} &#13;
List&lt;${argType}&gt; ${newName} = new ArrayList&lt;${argType}&gt;(); </template>
	<template autoinsert="true" context="java" deleted="false" description="Logger setup" enabled="true" name="logger">${:import(org.apache.commons.logging.Log,&#13;
	org.apache.commons.logging.LogFactory)} &#13;
&#13;
private static final Log log = LogFactory.getLog(${enclosing_type}.class);</template>
	<template autoinsert="true" context="java" deleted="false" description="Log with specified level" enabled="true" name="loglevel">${:import(java.util.logging.Level)} &#13;
if(${log:var(java.util.logging.Logger)}.isLoggable(Level.${LEVEL})) {&#13;
   ${log:var(java.util.logging.Logger)}.${level}(${});&#13;
}&#13;
${cursor}</template>
	<template autoinsert="true" context="java" deleted="false" description="Create a new generic HashMap" enabled="true" name="map">${:import(java.util.Map,&#13;
  java.util.HashMap)} &#13;
Map&lt;${argType},${argType}&gt; ${newName} = new HashMap&lt;${argType},${argType}&gt;(); </template>
	<template autoinsert="true" context="java" deleted="false" description="Iterate through a map, print the keys and values" enabled="true" name="map-iterate">${:import(java.util.Iterator,  &#13;
           java.util.Map)}&#13;
for (Iterator&lt;Map.Entry&lt;${type},${type2}&gt;&gt; it = ${collection}.entrySet().iterator(); it.hasNext();) {&#13;
    Map.Entry&lt;${type},${type2}&gt; entry = it.next();&#13;
    ${type} key = entry.getKey();&#13;
    ${type2} value = entry.getValue();&#13;
    // do something with the key and the value&#13;
}&#13;
	</template>
	<template autoinsert="true" context="java" deleted="false" description="Parse a time using SimpleDateFormat" enabled="true" name="parsetime">${:import(java.text.DateFormat,&#13;
		  java.text.ParseException,&#13;
		  java.text.SimpleDateFormat,&#13;
		  java.util.Date)}&#13;
try {&#13;
    DateFormat formatter = new SimpleDateFormat("hh.mm.ss a");&#13;
    Date date = (Date)formatter.parse("02.36.33 PM");&#13;
} catch (ParseException e) {&#13;
	throw e;&#13;
}&#13;
	</template>
	<template autoinsert="true" context="java" deleted="false" description="Read a file line by line" enabled="true" name="readfile">${:import(java.io.BufferedReader,  &#13;
           java.io.FileNotFoundException,  &#13;
           java.io.FileReader,  &#13;
           java.io.IOException)}  &#13;
 BufferedReader in = null;  &#13;
 try {  &#13;
    in = new BufferedReader(new FileReader(${fileName}));  &#13;
    String line;  &#13;
    while ((line = in.readLine()) != null) {  &#13;
       ${process}  &#13;
    }  &#13;
 }  &#13;
 catch (FileNotFoundException e) {  &#13;
    logger.error(e) ;  &#13;
 }  &#13;
 catch (IOException e) {  &#13;
    logger.error(e) ;  &#13;
 } finally {  &#13;
    if(in != null) in.close();  &#13;
 }  &#13;
 ${cursor}&#13;
	</template>
	<template autoinsert="true" context="java" deleted="false" description="Log and rethrow a caught exception" enabled="true" name="rethrow">log.error("${cursor}");&#13;
throw ${exception_variable_name};</template>
	<template autoinsert="true" context="java" deleted="false" description="Print execution time of a block of code" enabled="true" name="time">long start = System.currentTimeMillis();&#13;
//TODO: Insert code here&#13;
${cursor}&#13;
long end = System.currentTimeMillis();&#13;
System.out.println("Operation took "+(end-start)+ "ms");</template>
	<template autoinsert="true" context="java" deleted="false" description="Create periodic Timer" enabled="true" name="timer">${:import(java.util.Timer,&#13;
		  java.util.TimerTask)} &#13;
int delay = 5000;   // delay for 5 sec.&#13;
int period = 1000;  // repeat every sec.&#13;
Timer timer = new Timer();&#13;
&#13;
timer.scheduleAtFixedRate(new TimerTask() {&#13;
        public void run() {&#13;
            //TODO: Insert code to execute here&#13;
			${cursor}&#13;
        }&#13;
}, delay, period);</template>
	<template autoinsert="true" context="java" deleted="false" description="Write a String to a file" enabled="true" name="writefile">${:import(java.io.BufferedWriter,&#13;
		  java.io.FileWriter,&#13;
		  java.io.IOException)} &#13;
try {&#13;
    BufferedWriter out = new BufferedWriter(new FileWriter(${cursor}"fileName"));&#13;
    out.write("aString");&#13;
    out.close();&#13;
} catch (IOException e) {&#13;
	throw e;	&#13;
}&#13;
	</template>
</templates>