1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 37 import org.apache.log4j.*; 38 39 public class StrictDispatcher implements ClassfileLoaderDispatcher { 40 public int dispatch(String filename) { 41 int result; 42 43 if (filename.endsWith(".jar")) { 44 result = ACTION_JAR; 45 Logger.getLogger(getClass()).debug("Dispatching \"" + filename + "\": ACTION_JAR"); 46 } else if (filename.endsWith(".zip")) { 47 result = ACTION_ZIP; 48 Logger.getLogger(getClass()).debug("Dispatching \"" + filename + "\": ACTION_ZIP"); 49 } else if (filename.endsWith(".class")) { 50 result = ACTION_CLASS; 51 Logger.getLogger(getClass()).debug("Dispatching \"" + filename + "\": ACTION_CLASS"); 52 } else if (new File(filename).exists()) { 53 result = ACTION_DIRECTORY; 54 Logger.getLogger(getClass()).debug("Dispatching \"" + filename + "\": ACTION_DIRECTORY"); 55 } else { 56 result = ACTION_IGNORE; 57 Logger.getLogger(getClass()).debug("Dispatching \"" + filename + "\": ACTION_IGNORE"); 58 } 59 60 return result; 61 } 62 } 63 | Popular Tags |