Index: applications/editors/josm/plugins/mapillary/README
===================================================================
--- applications/editors/josm/plugins/mapillary/README	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/README	(revision 31185)
@@ -4,7 +4,7 @@
 Readme for your plugin 
 
-    * Polyglot and HolgerMappt
+    * nokutu <nokutu@openmailbox.org>
     
     * License: GPL v2 or later
       
-    * Notes for future developers, if needed.
+    * Feel free to contact me for any bug or suggestion.
Index: applications/editors/josm/plugins/mapillary/README.template
===================================================================
--- applications/editors/josm/plugins/mapillary/README.template	(revision 31184)
+++ 	(revision )
@@ -1,95 +1,0 @@
-README 
-======
-
-This is a template project structure for a JOSM plugin.
-
-Layout
-======
-+--- src                                source of your plugin
-  |- images                             images your plugin needs
-  |- resources                          resources your plugin needs
-
-  README                                README for your plugin
-
-  GPL-v2.0.txt                          GPL version 2 license text
-  GPL-v3.0.txt                          GPL version 3 license text
-  
-  README.template                       this file 
-  
-  
-Build
-=====  
-A JOSM plugin is built as a single jar. We use ant to build.
-
-See build.xml in this directory and update the plugin specific properties in the
-configuration section.
-
-To get an command overview run
-    > ant help
-
-To build the plugin run
-    > ant  dist
-
-To install the generated plugin locally (in you default plugin directory) run
-    > ant  install
-
-The generated plugin jar is not automatically available in JOSMs plugin configuration
-dialog. You have to check it in first.
-
-Use the ant target 'publish' to check in the plugin and make it available to other
-JOSM users:
-    set the properties commit.message and plugin.main.version
-and run
-    > ant  publish
-
-Maintaining versions
-====================
-There are two versions maintained with each plugin:
-   1) the main version
-      This is the lowest JOSM version required by this plugin.
-      You have to manually set the plugins main version in the build script.
-      Set the property plugin.main.version in build.xml accordingly. 
-
-   2) the build version
-      The build version is unique for every build of the plugin. It is equal
-      to the SVN revision of your plugin directory. 
-
- Both the main version and the build version are included in properties of the plugins
- manifest:
-    Plugin-Version      the build version
-    Plugin-Mainversion  the main version
-
- JOSM automatically detects whether a plugin needs to be upgraded. It compares the build
- version of the currently installed plugin jar with the build version of the plugin jar in 
- the SVN. The main version is irrelevant for this process.  
- 
- Making your plugin available to JOSM users
- ===========================================
- When a plugin jar is checked into SVN a script updates the plugins list on the JOSM wiki:
-   http://josm.openstreetmap.de/wiki/Plugins
- JOSM retrieves the list of available plugins and their build versions from this list.
-
-            commit      publish               read
-                       meta data              meta data 
-      Build  ==>  SVN  =======>  JOSM Wiki   <======= JOSM 
-                   ^ 
-                   ==================================
-                            fetch current plugin jar 
- 
- Note that you have to manually publish (commit) your plugin jar. There is no nightly build
- in place. Everything else (pulishing meta data, updating plugins in the client) is then handled 
- by automatic processes. 
-
-See also
-========
-* Developing Plugins 
-  http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
-  
-* List of JOSM Plugins
-  http://josm.openstreetmap.de/wiki/Plugins
-  
-  
- 
-     
-
- 
Index: applications/editors/josm/plugins/mapillary/build.xml
===================================================================
--- applications/editors/josm/plugins/mapillary/build.xml	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/build.xml	(revision 31185)
@@ -24,5 +24,5 @@
          See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
     -->
-    <property name="plugin.author" value="Nokutu"/>
+    <property name="plugin.author" value="nokutu <nokutu@openmailbox.org>"/>
     <property name="plugin.class" value="org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin"/>
     <property name="plugin.description" value="Enables user to work with pictures hosted at mapillary.com"/>
@@ -30,5 +30,5 @@
     <!-- <property name="plugin.link" value="..."/>-->
     <!--<property name="plugin.early" value="..."/>-->
-    <!--<property name="plugin.requires" value="commons-imaging"/>-->
+    <property name="plugin.requires" value="commons-imaging"/>
     <!--<property name="plugin.stage" value="..."/>-->
     
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31185)
@@ -1,16 +1,11 @@
 package org.openstreetmap.josm.plugins.mapillary;
 
-import org.apache.commons.jcs.access.CacheAccess;
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
 import org.openstreetmap.josm.data.cache.CacheEntry;
 import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
 import org.openstreetmap.josm.data.cache.ICachedLoaderListener;
-import org.openstreetmap.josm.data.cache.JCSCacheManager;
 import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
 
-import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -147,6 +142,6 @@
 	/**
 	 * Selects a new image and then starts a new MapillaryImageDownloadThread
-	 * thread in order to download its surrounding thumbnails. If the
-	 * user does ctrl+click, this isn't triggered.
+	 * thread in order to download its surrounding thumbnails. If the user does
+	 * ctrl+click, this isn't triggered.
 	 * 
 	 * @param image
@@ -160,30 +155,21 @@
 			MapillaryToggleDialog.getInstance().setImage(selectedImage);
 			MapillaryToggleDialog.getInstance().updateImage();
-			CacheAccess<String, BufferedImageCacheEntry> prev = null;
-			try {
-				prev = JCSCacheManager.getCache("mapillary");
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
 			if (image.next() != null) {
 				new MapillaryCache(image.next().getKey(),
-						MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
-						new HashMap<String, String>()).submit(this, false);
+						MapillaryCache.Type.THUMBNAIL).submit(
+						this, false);
 				if (image.next().next() != null)
 					new MapillaryCache(image.next().next().getKey(),
-							MapillaryCache.Type.THUMBNAIL, prev, 200000,
-							200000, new HashMap<String, String>()).submit(this,
-							false);
+							MapillaryCache.Type.THUMBNAIL)
+							.submit(this, false);
 			}
 			if (image.previous() != null) {
 				new MapillaryCache(image.previous().getKey(),
-						MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
-						new HashMap<String, String>()).submit(this, false);
+						MapillaryCache.Type.THUMBNAIL).submit(
+						this, false);
 				if (image.previous().previous() != null)
 					new MapillaryCache(image.previous().previous().getKey(),
-							MapillaryCache.Type.THUMBNAIL, prev, 200000,
-							200000, new HashMap<String, String>()).submit(this,
-							false);
+							MapillaryCache.Type.THUMBNAIL)
+							.submit(this, false);
 			}
 		}
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31185)
@@ -1,7 +1,12 @@
 package org.openstreetmap.josm.plugins.mapillary;
+
+import java.io.IOException;
 
 import javax.swing.ImageIcon;
 import javax.swing.JMenuItem;
 
+import org.apache.commons.jcs.access.CacheAccess;
+import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
+import org.openstreetmap.josm.data.cache.JCSCacheManager;
 import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.Main;
@@ -28,4 +33,6 @@
 			"mapiconselected.png").get();
 	public static final int ICON_SIZE = 24;
+	
+	public static CacheAccess<String, BufferedImageCacheEntry> CACHE;
 
 	private final MapillaryDownloadAction downloadAction;
@@ -48,4 +55,9 @@
 				false, 14);
 		EXPORT_MENU.setEnabled(false);
+		try {
+			CACHE = JCSCacheManager.getCache("mapillary", 10, 10000, this.getPluginDir() + "/cache/");
+		} catch (IOException e) {
+			Main.error(e);
+		}
 	}
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java	(revision 31185)
@@ -11,9 +11,6 @@
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.HashMap;
-
-import org.apache.commons.jcs.access.CacheAccess;
+
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
 import org.openstreetmap.josm.data.cache.CacheEntry;
 import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
@@ -114,13 +111,11 @@
 				this.previousButton.setEnabled(false);
 
-			CacheAccess<String, BufferedImageCacheEntry> prev;
 			try {
 				this.mapillaryImageDisplay.setImage(null);
-				prev = JCSCacheManager.getCache("mapillary");
+				MapillaryPlugin.CACHE = JCSCacheManager.getCache("mapillary");
 				if (thumbnailCache != null)
 					thumbnailCache.cancelOutstandingTasks();
 				thumbnailCache = new MapillaryCache(image.getKey(),
-						MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
-						new HashMap<String, String>());
+						MapillaryCache.Type.THUMBNAIL);
 				thumbnailCache.submit(this, false);
 
@@ -128,6 +123,5 @@
 					imageCache.cancelOutstandingTasks();
 				imageCache = new MapillaryCache(image.getKey(),
-						MapillaryCache.Type.FULL_IMAGE, prev, 200000, 200000,
-						new HashMap<String, String>());
+						MapillaryCache.Type.FULL_IMAGE);
 				imageCache.submit(this, false);
 			} catch (IOException e) {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java	(revision 31185)
@@ -3,10 +3,10 @@
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Map;
+import java.util.HashMap;
 
-import org.apache.commons.jcs.access.behavior.ICacheAccess;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
 import org.openstreetmap.josm.data.cache.JCSCachedTileLoaderJob;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 
 public class MapillaryCache extends
@@ -20,8 +20,6 @@
 	}
 
-	public MapillaryCache(String key, Type type,
-			ICacheAccess<String, BufferedImageCacheEntry> cache,
-			int connectTimeout, int readTimeout, Map<String, String> headers) {
-		super(cache, connectTimeout, readTimeout, headers);
+	public MapillaryCache(String key, Type type) {
+		super(MapillaryPlugin.CACHE, 50000, 50000, new HashMap<String, String>());
 		this.key = key;
 		try {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java	(revision 31184)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java	(revision 31185)
@@ -4,17 +4,12 @@
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.HashMap;
 import java.util.concurrent.ArrayBlockingQueue;
 
 import javax.imageio.ImageIO;
 
-import org.apache.commons.jcs.access.CacheAccess;
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
 import org.openstreetmap.josm.data.cache.CacheEntry;
 import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
 import org.openstreetmap.josm.data.cache.ICachedLoaderListener;
-import org.openstreetmap.josm.data.cache.JCSCacheManager;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
@@ -50,15 +45,7 @@
 	@Override
 	public void run() {
-		try {
-			CacheAccess<String, BufferedImageCacheEntry> prev = JCSCacheManager
-					.getCache("mapillary");
-			new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE,
-					prev, 200000, 200000, new HashMap<String, String>())
-					.submit(this, false);
-		} catch (MalformedURLException e) {
-			Main.error(e);
-		} catch (IOException e) {
-			Main.error(e);
-		}
+		new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE).submit(this,
+				false);
+
 	}
 
